Home > Article > Web Front-end > Solution to the problem of 2 requests when ajax cross-domain submission in jquery
We usually don’t have this situation when requesting pages in the same domain. This situation mostly occurs in cross-domain requests on the mobile side. The solution is to add a layer of filtering HTTP request types on the server to filter out unused types such as OPTION. That is when the request is false. This article will bring you a brief discussion on the problem of two requests when ajax cross-domain submission in jquery. The editor thinks it is quite good, so I will share it with you now and give it as a reference. I hope it can help everyone.
The following code will not be executed during GET and POST in HTTP, so that only one request can be executed.
In ASP.NET we use
##
Request.ServerVariables["REQUEST_METHOD"] == "POST"
Or
Request.ServerVariables["REQUEST_METHOD"] == "GET"can be filtered. Other languages are similar. Related recommendations:
Examples explain the four methods of AJAX cross-domain request data
Detailed introduction to AJAX cross-domain request
javascript - ajax cross-domain request issue
The above is the detailed content of Solution to the problem of 2 requests when ajax cross-domain submission in jquery. For more information, please follow other related articles on the PHP Chinese website!