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?
精彩评论