There are two different domain names. Click a button for the project in the first domain name, call the project interface in the second domain name, and then implement logical functions in the project of the second domain name, I would like to ask how the great gods can return project data from the second domain name to the function called by the first domain name. There are two different domain names. Click a button for the project in the first domain name, call the project interface in the second domain name, and then implement logical functions in the project of the second domain name, I would like to ask how the great gods can return project data from the second domain name to the function called by the first domain name.
Reply content:
There are two different domain names. Click a button for the project in the first domain name, call the project interface in the second domain name, and then implement logical functions in the project of the second domain name, I would like to ask how the great gods can return project data from the second domain name to the function called by the first domain name.
This is cross-origin Baidu.
Use jsonp
In the backend, the second domain name provides a restful api call through http,
If front-end calling is required, which of the following is the first solution to the Cross-origin problem? ajax is your best choice. If there is a cross-origin problem, JOSNP is optional.
If the interface is called for a webpage, jsonp can be used, but only applicable to get requests. You can also use ajax. to resolve cross-origin, you need to add the origin header.
Jsonp or ajax + header ("Access-Control-Allow-Origin :*");