JS / JQuery中的交叉域获取请求 [英] Cross Domain Get Request in JS/JQuery
本文介绍了JS / JQuery中的交叉域获取请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有使用服务器代理来执行跨域GET或POST请求的方法?
Is there a way without using a server proxy to perform a cross domain GET or POST request?
推荐答案
只有当天的浏览器并且可以控制外部网域,您可以使用跨源资源共享 [CORS]
If you are with only the current day browsers and have control over the external domain, you can use Cross-Origin Resource Sharing [CORS]
大多数人没有那么奢侈,所以你必须使用JSON和Padding [JSONP],否则你需要使用服务器代理。
Most people do not have that luxury so you either have to use JSON with Padding [JSONP] or you need to use a serverside proxy.
这篇关于JS / JQuery中的交叉域获取请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文