Reputation: 1423
$(document).load("somepage.aspx", function (responseText, textStatus, xhr) {
});
This is not working.
Is there any way to use the load function to replace the entire document including the head?
EDIT: I don't want to refresh my page, I have to use AJAX.
Upvotes: 5
Views: 3601
Reputation: 140230
$.get("somepage.aspx", function (data) {
document.open();
document.write(data);
document.close();
$.cache = {};
}, "text");
Upvotes: 7
Reputation: 1726
You should redirect you page when page is completely loaded.
$(window).load(function(){
document.href.location = "your_page";
});
Upvotes: 0
Reputation: 41433
$(function(){
$.get('my_page.html', function(e){
$(document).empty().append(e);
});
});
Try that. my_page.html gets loaded, then jQuery finds the document object, removes everything and appends it with the my_page.html content.
Upvotes: 0
Reputation: 6432
You could use a Jquery Ajax query to grab some html from the server the remove everything from the document and replace it with the content.
Upvotes: 0