jQuery.get(window.location.href, function(data) {
alert(data);
alert($(data).html());
});
The first popup is all the HTML good and healthy.
The second popup is blank. Why? (the HTML is XHTML compliant)
jQuery.get(window.location.href, function(data) {
alert(data);
alert($(data).html());
});
The first popup is all the HTML good and healthy.
The second popup is blank. Why? (the HTML is XHTML compliant)
Because it will return a string with all the HTML.
data
isn't a jQuery object.From the documentation:
If you are fetching a complete HTML document, then you will have lots of elements that may not appear in a div.
Change your code to something like this
The html in data will be placed in the div tag
I tried this on my PC. You get back the following:
This will not parse into a jQuery obejct. You get needs to be on a server-side script page that will explicitly output HTML.
I suppose if you really need an item in the HTML then you can strip it out from the text using the built-in string methods.