解决方法
我强烈建议不要这样做,原因如本文所述:Why not just using ajax for Page Requests to load the page content?
The whole premise really is that with
AJAX you don’t need to reload the
whole page to update a small
percentage of that webpage. This saves
bandwidth and is usually much quicker
than reloading the whole page.But if you are using AJAX to load the
whole page this is in fact
counterproductive. You have to write
customised routines to deal with the
callback of the AJAX data. Its a whole
lot of extra work for little to no
increase in performance.General rule for where to use AJAX: If
your updating >50% of your page,just
reload,else use AJAX.
您不仅需要请求新页面,还要确保删除当前页面上的旧样式并且不会干扰新页面.你想要做的事情有各种各样的问题.这是可能的,但我建议不要这样做.
编辑:实际上你可能只能做document.write(ajax.responseText),它应该负责覆盖文档中的所有内容,包括css样式等.虽然仍然不推荐它.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。