使用以下代码执行ajax get请求可以正常工作:
$.ajax({
type: "GET",
contentType: "application/json",
url: "http://someSeceretUrl/test/document,
dataType: "jsonp",
success: function(msg) {
console.log(msg);
},
error: function(a,b,c) {
console.log(a);
console.log(b);
console.log(c);
}
});
但PUT ajax呼吁使用以下代码:
$.ajax({
type: "PUT",
contentType: "application/json",
url: "http://someObscureURL/test/mrmer1",
dataType: "jsonp",
data: {"name":"mike"},
success: function(msg) {
console.log(msg);
},
error: function(a,b,c) {
console.log("XMLHttpRequest: " + a);
console.log("textStatus: " + b);
console.log("errorThrown: " + c);
}
});
成果如下:
XMLHttpRequest: [object XMLHttpRequest]
textStatus: null
errorThrown: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://static.kobj.net/kobj-static-20100219162227.js Line: 371"]
I am thinking that something is blocking the PUT request, but I don t know. What am I doing wrong?
感谢!