For example, when I do something like this:
$('#foo').load(window.location + ' #foo');
One would expect the code mentioned supra to reload the contents of the div with an id of foo. But no.
But what it actually gives me, if the content of foo is:
<div id="foo">
Foofoo
</div>
It will give me:
<div id="foo">
<div id="foo"><!-- Retrieved from the other page, don't want this -->
Foofoo
</div><!-- Don't want this either -->
</div>
But I just want the contents of the div foo. I don’t want to add any child elements, so I was just wondering if it was possible to change the configuration to only load the contents, or another way if possible.
What you want to use is
.html().