2012-07-09 17:11
浏览 46


Is there any way you can push data to a page rather than checking for it periodically?

Obviously you can check for it periodically with ajax, but is there any way you can force the page to reload when a php script is executed?

Theoretically you can improve an ajax request's speed by having a table just for when the ajax function is supposed to execute (update a value in the table when the ajax function should retrieve new data from the database) but this still requires a sizable amount of memory and a mysql connection as well as still some waiting time while the query executes even when there isn't an update/you don't want to execute the ajax function that retrieves database data.

Is there any way to either make this even more efficient than querying a database and checking the table that stores the 'if updated' data OR tell the ajax function to execute from another page?

I guess node.js or HTML5 webSocket could be a viable solution as well?

Or you could store 'if updated' data in a text file? Any suggestions are welcome.

图片转代码服务由CSDN问答提供 功能建议



从理论上讲,你可以改进一个 ajax请求的速度是通过为ajax函数执行时提供一个表(当ajax函数应该从数据库中检索新数据时更新表中的值)但这仍然需要大量的内存和mysql连接作为 以及在查询执行时仍然有一些等待时间,即使没有更新/你不想执行检索数据库数据的ajax函数。

有什么方法可以 或者使这比查询数据库和检查存储'if updated'数据的表更有效,或者告诉ajax函数从另一个页面执行?

我想node.js或者 HTML5 webSocket也可以成为一个可行的解决方案吗?

或者您可以在文本文件中存储“if updated”数据? 欢迎任何建议。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

相关推荐 更多相似问题