开发者

Virtual Forms vs Ajax POST

Ajax can't do cross-domain post due to the same-origin policy. But, if we use Ajax to dynamic create a virtual form and do a cross-domain post, then the browser allows it.

Aren't they doing the same thing? Why does the browser al开发者_如何学Clow one but not the other?


Ajax can - it's called JSONP (Padded JSON). jQuery has this built into it's ajax object

$.ajax({
url:'http://www.otherdomain.com',
crossDomain:true,
...
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜