Get the App
SLTechnology News&Howtos  ›  Development  › 

How to set a timeout with ajax

Shulou Source: shulou.com Published: 2022-06-03 08:27:45 09月16日 Update

This article mainly explains "how to set timeout with ajax". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to set timeout with ajax".

This operation will take more than 5 minutes to complete, engineering environment apache2+tomcat6.0.

An online search found several places where timeouts can be set:

1.ajax syntax to set units of milliseconds, for example:

$.ajax ({url: XXX, timeout: 600000, type: 'POST', data: {}, error: function () {show_fail_meg ("failed to start system!") ;})

2.tomcat configure server.xml unit millisecond

Connector port= "8080" protocol= "HTTP/1.1" connectionTimeout= "20000" redirectPort= "8443" URIEncoding= "UTF-8" / >

3.apache configuration file httpd.conf (in second)

# # Timeout: The number of seconds before receives and sends time out. # Timeout 60

After modifying the above, it was found that it still did not take effect, and finally located in the mod_jk module.

Mod_jk, referred to as JK, is a pluggable module of the Apache server, which is used to provide Apache or IIS servers with the ability to process JSP/Servlet.

In other words, the settings of JK may override the settings of apache2 and tomcat as well as ajax.

The configuration file / etc/httpd/conf/workers.properties for JK is as follows:

Worker.master.socket_timeout=300

Sure enough, I saw that this number is exactly 5 minutes, which is consistent with the abnormal phenomenon. It is normal to restart after changing the size.

Thank you for reading, the above is the content of "how to use ajax to set timeout". After the study of this article, I believe you have a deeper understanding of how to use ajax to set timeout, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Content unit learning configuration place file server module service consistency that is engineering ideas situation numbers articles more environment Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MySQL vpn Apple MariaDB