通知用户数据库更改? JavaScript/AJAX [英] Notify user on database change? JavaScript/AJAX

查看:89
本文介绍了通知用户数据库更改? JavaScript/AJAX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是的

对于整个JavaScript业务,我真的很陌生,更不用说AJAX了,所以我在想,如果你们能帮我一个难题的话.

I'm really quite new to this whole JavaScript business, not to mention AJAX, so I was thinking if you guys could help me out with a conundrum.

基本上,我想要的是在MySQL表的值发生更改时通知用户.我该怎么办?我应该使用jQuery,还是可以自己拍一些东西?

Basically, what I want is for the user to be notified upon a change in a value of a MySQL table. How should I go about that? Should I use jQuery, or can I slap something together myself?

感谢所有答复.

推荐答案

根据需要通知用户的速度,您可以使用轮询(每X秒发送一次请求以查看是否有新内容)或使用彗星.

Depending on how quickly you need the users to be notified, you could use either polling (sending a request every X seconds to see if there's anything new) or use comet.

无论如何,您将需要服务器端编程语言来查询数据库并提供结果,并且客户端需要一些javascript来发送请求和显示响应.我强烈建议使用jQuery库,因为它简化了很多跨浏览器的不兼容性.

In any case, you'll need a server side programming language to be querying the database and serving the results, and you'll need some javascript on the client-side to be sending requests and displaying responses. I would highly recommend using the jQuery library, since it simplifies a lot of cross-browser incompatibility.

这篇关于通知用户数据库更改? JavaScript/AJAX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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