Why does this jQuery fail to load/parse my HTML string?
问题 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) 回答1: From the documentation: The HTML string cannot contain elements that are invalid within a div, such as html, head, body, or title elements. If you are fetching a complete HTML document, then you will have lots of elements that may not appear in a div. 回答2: Because it will return a string