Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

replace page with jquery $.post response

I'm using jquery's $.post like this:

$.post("/searchresult", $("#searchDiv").serialize(), function(data) { //??? });

The "data" parameter has all the html code of the result page I want.

The question is how do I replace my current page's content with this one returned by the $.post function.

Thanks,

Rui

like image 918
Rui Avatar asked Dec 11 '09 19:12

Rui


1 Answers

$('body').html(data); should do it.

like image 172
Matěj G. Avatar answered Sep 21 '22 03:09

Matěj G.