Is it possible to use JQuery.Load () to replace the entire document?

    $(document).load("somepage.aspx", function (responseText, textStatus, xhr) {

});

This does not work.
Is there a way to use the download function to replace the entire document, including the head?

EDIT: I don't want to refresh my page, I have to use AJAX.

+5
source share
5 answers
$.get("somepage.aspx", function (data) {
    document.open();
    document.write(data);
    document.close();
    $.cache = {};
}, "text");
+7
source

You can use the Jquery Ajax request to grab some html from the server, to remove everything from the document and replace it with content.

0
source

iframe .

0
$(function(){
    $.get('my_page.html', function(e){
        $(document).empty().append(e);
    });
});

. my_page.html , jQuery , my_page.html.

0

, .

    $(window).load(function(){
       document.href.location = "your_page";
    });
0

All Articles