How to retrieve content via .load() or $.get() with this line
hello :) I posted a question a day or two ago about how to retrieve php via ajax method in this modal I was using. I kinda found out the right way to go about it, but there's still something I'm 开发者_运维百科not doing right (obviously lol) Here's the section thats giving me the issues:
jQuery('div that holds content').fadeIn(200).css({ 'width': Number( popWidth ) });
$('').load('/something/somewhere/this #content');
So, im using safari, and a local server (mamp), when I check activity in my browser, it shows that it is loading the content with every click, AND the pop up pops up, but no content. When I simply retrieve content via hidden div, ofcourse, i get it. This is what I'm trying to avoid. right now I have that div in my footer stashed as hidden. I'd rather just make a call when its needed, instead of loading it every single time a page is accessed.
you can go here to see the whole script i posted in my last question: How to use ajax to show php in a modal pop up
Anyone have any idea? I read that .load()
has the ability to grab specific content from a request, but im not sure the major difference between that and $.get()
I've tried both, and I get the same results. Im using wordpress, and wordpress's ajax requests run smooth as ever, so I know its not a local problem, i'ts my coding lol
Ok....Im done typing :)
For that to work, there must be a URL at your site, /something/somewhere/this
. That page needs to contain an element with an id content
.
See "Loading Page Fragments" at the load
documentation
精彩评论