如何实时在HTML屏幕中显示日志查看器

时间:2023-01-22 23:22:28

I want to show the contents of a log file which is constantly updating in the back ground in my HTML page in real time. I am using jQuery. Is there any jQuery plugins to do so. I have Websockets but those doesn't work in our existing framework. Please suggest any ideas or links.Thanks

我想显示一个日志文件的内容,该文件在我的HTML页面的实地中不断更新。我正在使用jQuery。有没有任何jQuery插件可以这样做。我有Websockets但这些在我们现有的框架中不起作用。请提出任何想法或链接。谢谢

1 个解决方案

#1


0  

You can use AJAX and setInterval.

您可以使用AJAX和setInterval。

setInterval(function(){
 getlog();
}, 2000);

If websockets doesn't exists in your existing framework this is the best.

如果现有框架中不存在websockets,那么这是最好的。

You can also try out Long Polling with AJAX. Maybe the answer for this question will help you: Simple long polling example with JavaScript and jQuery

您还可以尝试使用AJAX进行Long Polling。也许这个问题的答案可以帮助你:使用JavaScript和jQuery的简单长轮询示例

#1


0  

You can use AJAX and setInterval.

您可以使用AJAX和setInterval。

setInterval(function(){
 getlog();
}, 2000);

If websockets doesn't exists in your existing framework this is the best.

如果现有框架中不存在websockets,那么这是最好的。

You can also try out Long Polling with AJAX. Maybe the answer for this question will help you: Simple long polling example with JavaScript and jQuery

您还可以尝试使用AJAX进行Long Polling。也许这个问题的答案可以帮助你:使用JavaScript和jQuery的简单长轮询示例