Javascript 聊天多次显示相同的消息
我正在尝试让聊天工作,这是从教程中复制粘贴的。由于某种原因,聊天加载功能似乎每次应该运行一次时都运行两次!这真是要了我的命,我不知道出了什么问题。
这是我的复制粘贴聊天: http://www.releazed.com/chat/
这里是完整源代码:http://myslimchatroom.wikidot.com/
我认为它与last_message_id有关但我一直在调试它,它似乎知道正确的...
请帮助:(
i am trying to get a chat working that is a copy paste from a tutorial. For some reason the chat load funcion seems to run twice everytime its supposed to run once! This is killing me, i cant figure out whats wrong.
Here is my copy paste chat: http://www.releazed.com/chat/
here is the full source code: http://myslimchatroom.wikidot.com/
I would think its something related to the last_message_id but ive been debuging it and it seems to know the right one...
Please help :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
将发送末尾的Load ) 替换
为仅写入屏幕的函数
replace Load )
from the end of send with a function that just writes to the screen
尝试将您的 php 代码从 修复
为
Try to fix your php code from
to
这可能有效,在 Load() 函数中将 $post 命令更改为:
This might work, in the Load() function change the $post command to this:
在您的代码中,Load() 函数中缺少用于查看加载是否已在进行中的 if 语句。 (你复制的地方没问题,不知道哪里出了问题):
In your code, the if statement to see if the load is already in process is somehow missing from the Load() function. (It was fine in the place you copied from, I don't know what went wrong):
通过简单地删除 JS
eval(result);
的最重要部分之一解决了问题,哈哈...我猜 jquery 是自己做的?嗯,它的工作...fixed the problem by simply removing one of the most important parts of the JS
eval(result);
lol... i guess jquery does this on its own? Well its working...