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,
...
});
精彩评论