There is a problem
Do the front-end, using AJAX to get data, is often the case, the same domain naturally no problem, if it is different domain access to data, browsers have a homologous policy restrictions.
As shown in figure:
XMLHttpRequest Cannot load Origin * is not allowed by Access-control-allow-origin
Some would say it's jsonp. If the backend data interface simply returns simple JSON data, it cannot modify the data format that conforms to the Jsonp method. What should we do at this time? If you use a browser that is chrome, then there is the gospel. After opening the chrome address plus--args--disable-web-security can screen security access [--args: This parameter is optional], and then randomly call the data in different fields.
The specific steps are as follows:
Chrome under Windows System (WIN7)
1, close all open chrome. (important). Otherwise, there will be no effect.
2, to create a chrome shortcut, modify the target of the shortcut:
"C:\Program Files\google\chrome\application\chrome.exe"--args--disable-web-security
Figure: Creating a Chrome Shortcut
3. Double-click the Chrome shortcut we created to open chrome, as shown "you are using an unsupported command line tag: –disable-web-security." Stability and security will decrease ", which means that you have canceled cross-domain restrictions, and you can call data across domains arbitrarily.
As shown in figure: you are using an unsupported command-line tag:--disable-web-security. Stability and security will decrease with the Mac OS below
/applications/google\ chrome.app/contents/macos/google\ Chrome--disable-web-security
Or
Open-a "Google Chrome"--args--disable-web-security
Ubuntu? Linux:
Chromium-browser--disable-web-security
Open the Apple Safafi method using the command line: (under Mac OS)
Open-a '/applications/safari.app '--args--disable-web-security