I have this HTML page, and I want to create a jQuery method that gathers the HTML content of another page.
For instance, I want to get the HTML content between the tags, including child tags, attributes, text..
I’ve come up with something like:
<script>
var page;
$(document).ready(function() {
$.ajax({
type : "GET",
url : "template.html",
dataType : "html",
success : function(html) {
page = $(html).find('body').html();
//do something
}
});
});
</script>
but it doesn’t do the trick.
any idea? thank you.
You could use the JQuery Load-function.
This function loads the html from the div with id
containerfrom the pageajax/test.htmland puts the html into the div with idresult.source: http://api.jquery.com/load/