AJAX不断寻找服务器更新?使用Javascript [英] AJAX constantly look for server update? Javascript

查看:86
本文介绍了AJAX不断寻找服务器更新?使用Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一种情况需要随意更新网页上的显示。我想这样做是AJAX,但我不知道如何做到这一点除了做

I have a situation where a display on a webpage needs to be updated at random. I am wanting to do this in AJAX but am not sure how to do this other than to do a

while(true) { ajaxFunction(); sleep(1) }

类型的事情。

Type thing.

这里的问题是,网页需要被更新很快就更改了服务器,但这些更改可能发生非常零星,有时从来没有。

The problem with this is that the webpage needs to be updated very quickly on a change to the server, but the changes could happen very sporadically sometimes never.

编辑:这是用一个UIWebView的iPhone应用程序,是有可能使用iPhone的推送通知使用JavaScript接口

This is an Iphone application using a UIWebView, is it possible to use the iPhone's push notification to interface with the javascript?

谢谢!

推荐答案

我觉得你描述什么是的彗星并有一对夫妇插件jQuery的:

I think what you're describing is Comet and there are a couple of plugins for jQuery:

HTTP://$c$c.google.com/p/jquerycomet/

http://plugins.jquery.com/project/Comet

这篇关于AJAX不断寻找服务器更新?使用Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆