How to replace the entire html webpage with ajax 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


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

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

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

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