POST方法不适用于Request标头

时间:2012-02-28 06:18:45

标签: youtube xmlhttprequest request-headers

我想通过POST方法将数据发送到youtube。我在代码中写了 http.open(“POST”,myUrl,true); ,如下所示

var myUrl = "https://gdata.youtube.com/action/GetUploadToken";
 http.open("POST", myUrl, true);
            http.setRequestHeader("Authorization", "AuthSub token=" + code);
            http.setRequestHeader("GData-Version", 2);
            http.setRequestHeader("X-GData-Key", "key="+dev_key);
            http.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

但错误是

Request URL:https://gdata.youtube.com/action/GetUploadToken
Request Method:OPTIONS
Status Code:405 Method Not Allowed

请告诉我这里有什么不对

1 个答案:

答案 0 :(得分:0)

AJAX不允许您向托管代码的域以外的域发送请求吗?