Use jQuery to load element from another page

You can use jQuery to load any element from another page as easy as you get it from the same document.

Here is how (/source):

$.get("../index.html #header1", function(data)
{
    $("#indexHeader1").html(data);
    
    alert("Load was performed.");
});

It’s no magic. It’s a regular AJAX call, only jQuery parses result and tries to strip requested element only.

Leave a Reply