AJAX XMLHttpRequest POST X-Domain

问题描述:

我使用POST over X-Domain发送一个AJAX请求,用于我们为我们的网站生成的小部件。

I am sending an AJAX request using POST over X-Domain for a widget we are producing for our website. The problem we are facing is that this is getting blocked.

我的问题是 - 对于现代浏览器[Chrome,Safari,FF,IE8] - 这是我的理解设置访问控制标题

My question is - for "modern browsers" [Chrome, Safari, FF, IE8] - it is my understanding that setting "Access-Control" headers

Access-Control-Allow-Origin: http://www.test.com
Access-Control-Allow-Methods: POST, GET, OPTIONS
Access-Control-Allow-Headers: *
Access-Control-Max-Age: 1728000

将允许这些POST请求工作?但对于IE7,我们需要实现一些定制的JSONP解决方案?

Will allow these "POST" requests to work ? But for IE7 we need to implement some "custom" JSONP solution?

这可以工作,但不使用标准的XmlHttpRequest对象。例如,在IE8中,您应该使用 XDomainRequest 对象发送请求。对于这些情况,JSONP实际上更容易使用,并且工作在跨浏览器在jQuery中实现

This works but not using the standard XmlHttpRequest object. For example in IE8 you should use the XDomainRequest object to send the request. For these scenarios, JSONP is actually easier to use and works cross-browser as implemented in jQuery.