-1
AJAX請求有什麼問題?出於某種原因,我的瀏覽器將它作爲GET請求來挑選,當我將它指定爲一個帖子時?將Ajax指定爲POST但發出GET
var body = "<tsRequest><credentials name='username' password='password'><site contentUrl=''/></credentials></tsRequest>";
var url = "http://172.18.74.145/api/2.0/auth/signin";
$.ajax({
url: url,
crossDomain: true,
data: body,
type: 'POST',
contentType: "text/xml",
dataType: "jsonp",
success : console.log("too"),
error : function (xhr, ajaxOptions, thrownError){
console.log(xhr.status);
console.log(thrownError);
}
});
我得到的錯誤: GET http://172.18.74.145/api/2.0/auth/signin?callback=jQuery1720699254485778510 ...%20contentUrl =%27%27 /%3E%3C /憑證%3E%3C/tsRequest%3E & _ = 1442263213074 405(不允許的方法)
如果我將「ajax」更改爲「發佈」,那麼URL會搞砸。
我改變了這個,簡單的錯誤,但它仍然在發出GET請求。 – Ben
@Ben將鏈接添加到JSONP線程。 – wero