How to select and replace the whole page with jQuery

前端 未结 5 2111
Happy的楠姐
Happy的楠姐 2020-12-29 13:01

My design of a page forces me to refresh the whole page with html that I have loaded via ajax.

$(\'html\').replaceWith(data);

Gives me errors. A

5条回答
  •  灰色年华
    2020-12-29 13:43

    I had some issues with

    $("body").replaceWith(newPage)
    

    giving me some weird css problems, but this worked fine:

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

提交回复
热议问题