如何刷新一个div每次数据库更新? [英] How to refresh a div everytime a database is updated?
问题描述
我试图让我的网站上的聊天室,我是用PHP和MySQL来存储信息,所有的信息。我怎么能自动刷新每当有人更新了数据库的页面?例如:
I am trying to make a chat room on my website, I am using php and mysql to store the messages and all the info. How could I automatically refresh the page every time someone updates the database? example:
如果我在我的网站,该消息显示我的屏幕上,但我只能看到最近的消息我刷新页面后。有没有一种方法,使之实时?
If I am on my site, the messages show up on my screen but I can only see more recent messages after I refresh the page. Is there a way to make it real-time?
此外,我不知道很多的JavaScript / AJAX / jQuery的或任何。任何帮助AP preciated!
Also I do not know much javascript/ajax/jquery or any of that. Any help is appreciated!
将有在我的网站流量的低量。大概在10至15人同时就餐,如果连。
There will be low amount of traffic on my site. Probably around 10-15 people at a time, if that even.
推荐答案
您最好的选择就是让一个AJAX请求每个秒左右,查看是否有新邮件。
Your best bet is to make an AJAX request every sec or so and see if there are new messages.
这篇关于如何刷新一个div每次数据库更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!