Reputation: 15928
I am trying to solve a problem that I asked over here. To solve that problem, I am trying to do a jquery ajax, where I refresh the entire page with the response html. If I try
success: function (msg) {
$(document).html(msg);
},
it throws errors.
How do I tell jquery to replace the current page with the html contents received back in the response?
Upvotes: 2
Views: 3443
Reputation: 232
This should work.
$("body").html(content);
If the error persists, please paste the whole code because it's not possible to find the error without seeing it.
Upvotes: 1
Reputation: 52240
Try this
Upvotes: 0
Reputation: 649
You need to replace just the content that's changing on the page. I doubt that your header/footer are changing too. Add an ID to whatever wrapper div you have in your layout and then change your success to this:
success: function (msg) {
$("#ID_YOU_ADDED_GOES_IN_HERE").html(msg);
}
Upvotes: 3