jQuery ajax php long polling

谁说胖子不能爱 提交于 2019-12-05 18:31:34
XzKto

I think you should read top comment on Chrome AJAX on page-load causes "busy cursor" to remain - it seems it is Google Chrome specific and you need to wait before ALL content is loaded before making an ajax call.

EDIT: Just a recommendation - maby I am wrong: you should not use GET requests to make any huge/sensitive operations on your site as it can lead to and easy attack on your site. Anyone who owns/hacks some high-load site can insert an invisible iframe to their page so that any user that visits that page will make that GET request without even realising it - it can crash/harm your server (as thousands requests comes to your server). Most modern browsers will not let cross-site POST requests, so it should be safe.

EDIT 2: About your site being unavaliable while that script is still working even after you abort it: it is most likely because of sessions. Standard session behaviour will let only one php instance with same session running at the same moment - all other requests will wait untill that session is closed in all other scripts. You should close the session ASAP in script, use custom session handling that will enable multiple requests with the same session(most likely this will be really ugly) or detect user abort to close the sript as soon as user aborted it in browser.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!