嗨我正在通过OAuth 2.0验证用户的过程中,并且在制作时出现Access-Control-Allow-Origin错误(XMLHttpRequest cannot load https://www.box.com/api/oauth2/token. Origin http://localhost is not allowed by Access-Control-Allow-Origin.
)以下POST请求:进行HTTP请求时访问控制 - 允许 - 来源错误
var xhr=new XMLHttpRequest();
xhr.open('POST',path,true);
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xhr.onload = function() {
var text = xhr.responseText;
alert('Response from request to ' + path + ': ' + text);
};
xhr.onerror = function() {
alert('Woops, there was an error making the request.');
};
xhr.send(params);
任何帮助将不胜感激!我查看了CORS,JSONP,并添加了回调=?到的网址,但没有我试过正在工作。
ahhh我明白了,非常感谢你指出了这一点 – user2066880 2013-05-02 09:37:57