Home > Web Front-end > JS Tutorial > body text

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

小云云
Release: 2017-12-22 11:45:54
Original
2899 people have browsed it

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"
Copy after login

Or


Request.ServerVariables["REQUEST_METHOD"] == "GET"
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!