AJAX请求有什么问题?出于某种原因,当我将其指定为帖子时,我的浏览器将其作为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&amp; _ = 1442263213074 405(方法不允许)
如果我将“ajax”更改为“post”,那么网址就会搞砸。