Home  >  Article  >  Web Front-end  >  Solution to the problem of 2 requests when ajax cross-domain submission in jquery

Solution to the problem of 2 requests when ajax cross-domain submission in jquery

小云云
小云云Original
2017-12-22 11:45:543015browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn