动态更新网页内容而不刷新它? [英] Dynamically updating content of web page without refreshing it?
问题描述
我有一个多页网站,当我选择任何导航链接转到另一个页面时,它将每次重新加载整个页面.我想我可以使用AJAX和jQuery来创建XMLHttpRequest并为每个页面的body标签指定一个要定位的ID.
I have a multi page site that when I select any of the nav links to go to another page it reloads the whole page every time. I think I can use AJAX and jQuery to make an XMLHttpRequest and give the body tag of each page an ID to target.
但是,有没有更好的方法可以做到这一点?我一直在到处寻找帮助,几年前使用上述方法可以得到很多帮助.
However, is there a better way to accomplish this? I've been searching everywhere for help and get a lot of stuff from several years back using the above method.
在此先感谢您的帮助.
推荐答案
我认为您想构建一个单页应用程序(SPA).
I think you want to build a Single Page Application (SPA).
有许多框架可以帮助您构建此类应用程序,例如Angular,React等.
There are many frameworks out there that can help you build such apps, like Angular, React, etc.
这篇关于动态更新网页内容而不刷新它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!