开发者

XHR call returns HTML, how to use that and reload the entire page?

A XHR call returns HTML, how do I开发者_StackOverflow社区 tell the browser to use that and reload the entire page? I know the main use for XHR is to do partial page fresh but my case is a bit special. Thanks.

Or put it in a more general term, what is the best way to use JS to simulate a browser form GET request? window.location.replace("url")?


rather than trying to reload or something, have you considered doing something like

document.body.innerHTML = [the string HTML that you got back from XHR];

Or perhaps you could do it by building a new DOM from the HTML and then swapping it in?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜