Javascript-ajaxpost How do I resolve cross-domain issues?
Source: Internet
Author: User
KeywordsJavascriptphphtml5
Post requests can only crawl 200 and 404, can not catch other status code, is said to be a cross-domain problem, ask someone encountered? How to solve?
Reply content:
Post requests can only crawl 200 and 404, can not catch other status code, is said to be a cross-domain problem, ask someone encountered? How to solve?
Whether it is JSONP or cors, you need to be able to operate the server (for example, you get from a page on the B content, then you can modify the program on B or httpd to use JSONP or cors), if not your server, then there is no way.
1, the front-end can use JSONP 2, backstage can add the header (' access-control-allow-origin:* ') in the requested response header;
Write a filter in the background and output the following response headers with response:
Where: Access-control-allow-origin is set to * at development and set to specific domain name when publishing
Can operate the server, using Cors or JSONP. Cannot operate the server to see if there is JSONP service available. If the above two does not work, only the server can be processed, that is, browser → server → third-party server. The server interacts with the server, belongs to the network communication, the commonly used HTTP class or curl all line, most services all support get/post.
Change DataType to Jsonp
Introspection JSONP
Cross-domain problem can find the JSONP information
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.