The solutions for cross-domain request data mainly include the following solutions:
JSONP方式 表单POST方式 服务器代理 Html5的XDomainRequest Flash request
Separate instructions:
1. JSONP:
Intuitive understanding:
It is to dynamically register a function on the client
function a(data), and then pass the function name to the server, and the server returns an a({/*json*/}) to the client to run, thus calling the client's
function a(data), thus achieving cross-domain.
Birth background:
1. Ajax directly requests ordinary files, which has the problem of cross-domain access without permission. Regardless of whether it is a static page, dynamic web page, web service, or wcf, as long as it is a cross-domain request, it will not work.
2. However, when calling js files on the web page, it is not affected by this
3. Further promotion, we found that all tags with Src attributes have cross-domain capabilities, such as: