For example, $('#some-div').load('http://foo.bar #content') will retrieve #content from http://foo.bar but with all HTML <!--comments--> stripped.
How can I retrieve the contents of #content including any comments?
For example, $('#some-div').load('http://foo.bar #content') will retrieve #content from http://foo.bar but with all HTML <!--comments--> stripped.
How can I retrieve the contents of #content including any comments?
From the jQuery manual:
jQuery uses the browser's
.innerHTMLproperty to parse the retrieved document and insert it into the current document. During this process, browsers often filter elements from the document such as<html>,<title>, or<head>elements. As a result, the elements retrieved by.load()may not be exactly the same as if the document were retrieved directly by the browser.
So you should use $.get() to retrieve the HTML instead of $.fn.load()