仅刷新网站的特定部分/元素
我正在尝试从每秒刷新一次的网站接收一些数据。 我一直在考虑使用元标记,但不知何故网站上没有任何元标记。
我一直在考虑计时器和处理程序,但随后我必须刷新整个站点,才能接收更新的数据,该数据位于 html 文档的顶部。这会造成大量流量。
有没有办法只刷新页面的一部分甚至一个元素?如果是这样,怎么办?目前我正在使用 jsoup 从文档中获取数据。
What I'm trying is to receive some data off a website which is being refreshed once a second.
I've been thinking about making use of meta tags, but somehow there aren't any on the website.
I've heen thinking about timers and handlers, but then i would have to refresh the whole site, only to receive the updated data, which is located at the top of the html document. That would cause a lot of traffic.
Is there a way to only refresh a part or even only an element of a page? And if so, how? Currently I'm using jsoup to get data from a document.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果该网站不属于您的责任,并且没有提供任何 API 或 URL 用于仅获取您感兴趣的页面部分,那么您没有任何其他选择:必须完全重新加载网页。这就是网络的运作方式。
If the website is not under your responsibility, and hasn't provided any API or URL used to only get the part of the page you're interested into, then you don't have any other choice: the web page must be reloaded completely. That's how the web works.
看看阿贾克斯。只需调用一个非常简单的 JavaScript 函数即可刷新网页的一部分。
http://www.w3schools.com/ajax/default.asp
如果你只是想要进行运行计算,您可以使用 javascript 来完成:
Look at ajax. It takes a very simple javascript function call to refresh part of a webpage.
http://www.w3schools.com/ajax/default.asp
If you just want to do a running calculation you can do it with javascript: