How to replace the entire html webpage with ajax response?

If your response includes the <head> and <body> tags:

$("html").html(response);.

If not, and it's only content, then do:

$("body").html(response);.


if the response is the html content, you can use this line of code:

...
'success': function(response)
       {
           $("body").html(response);
       }
...

update:

this will be hard to replace the html tag, but what you can do:

...
'success': function(response)
       {
           $("html").html($("html", response).html());
       }
...

you parse the response with jquery, getting the content of html and replacing the content of the current html


this question has already been treated here: Replace HTML page with contents retrieved via AJAX

Basically, you may try (My bad this is not working on IE):

document.open();
document.write(newContent);
document.close();

or, since you are using jquery

$("body").html(data);

Regards