Interface Data Interaction in projects with different domain names

Source: Internet
Author: User
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 :*");

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.