POST method is not working with Request header
-
13-11-2019 - |
题
I want to send data to youtube by POST method. I write http.open("POST", myUrl, true); in the code as following
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");
but the error is
Request URL:https://gdata.youtube.com/action/GetUploadToken
Request Method:OPTIONS
Status Code:405 Method Not Allowed
Kindly tell me what is the wrong here
解决方案
AJAX doesn't allow you to send request to domains other than that which hosts the code?
不隶属于 StackOverflow