Ajax请求工作30秒 [英] Ajax requests work for 30 seconds

查看:130
本文介绍了Ajax请求工作30秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,该程序具有一些使用ajax的功能.我注意到有一段时间,在页面不活动的30秒内,所有ajax都只是功能性的.真奇怪当此时间到期时,ajax停止工作,并且使用此请求的每个组件都不再工作.

I have a program that has some functions that uses ajax. I noticed some time, that all ajax only funcioal during the 30 seconds of inactivity the page. This is weird. When this time expires, the ajax stops working and every component that uses this request does not work anymore.

示例:

我有一个带一个按钮的DataTable,可以打开一个对话框.默认情况下,primitivefaces ajax组件处于活动状态,当我单击按钮时,将打开一个对话框.仅在页面闲置30秒时才会发生这种情况. 配置的会话超时仍然不知道问题出在哪里.

I have a DataTable with a button that opens a dialog one. By default the primefaces ajax components are active, when I click on the button opens a dialog. only for that to happen if the page is idle for 30 seconds. Configured session timeout over yet still have no idea where the problem is.

注意:这在整个项目中都会发生,不仅发生在几页之内. 谢谢.

Note: This happens throughout the project, not only in a few pages. Thank you.

推荐答案

这个问题可能是很久以前提出的.但是我遇到了类似的问题,并且试图寻找代码中的错误已有很长时间了.原来真正的错误来自我的php.ini文件. PHP默认将 max_execution_time 设置为30秒,您可以调整php.ini文件以留出更多时间,也可以将以下代码添加到php脚本的开头:

This question was probably asked ages ago. But I ran into a similar problem and got stuck trying to find bugs in my code for ages. Turns out the real bug was from my php.ini file. PHP sets max_execution_time to 30 seconds by default, you can either tweak your php.ini file to allow greater time or simply add the below code to the beginning of your php script:

ini_set('max_execution_time',0);

PHP默认将 max_execution_time 设置为30秒,将值设置为0可以消除时间限制,并且只要浏览器窗口保持活动状态,ajax脚本就可以继续运行.

By default max_execution_time is set to 30 seconds by PHP, setting the value to 0 removes the time restraint and allows the ajax script to keep running as long as the browser window stays alive.

这篇关于Ajax请求工作30秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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