提交跨域ajax POST请求 [英] Submit cross domain ajax POST request
本文介绍了提交跨域ajax POST请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发誓我曾经看过一篇关于此的文章,但却找不到它......
I swear I saw an article about this at one point but can not find it...
如何在另一个上执行POST类型的jQuery ajax请求域?必须在没有代理的情况下完成。这可能吗?
How can I perform a jQuery ajax request of type POST on another domain? Must be accomplished without a proxy. Is this possible?
推荐答案
是的,你可以发布所有你想要的东西,甚至 $ .post()
有效...但你不会得到回复。
Yes you can POST all you want, even $.post()
works...but you won't get a response back.
这是有效的,其他域将获得POST:
This works, the other domain will get the POST:
$.post("http://othersite.com/somePage.php", { thing: "value" }, function(data) {
//data will always be null
});
但上面的回复数据
例如,由于同源政策,因此将为空。
But the response, data
in the above example, will be null due to the same-origin policy.
这篇关于提交跨域ajax POST请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文