嗨我正在通過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