使用jQuery函数时使用HTTP 405;发送选项
我遇到了一个非常奇怪的问题。下面的jQuery接收HTTP 405错误代码,并发送一个选项请求方法而不是GET使用jQuery函数时使用HTTP 405;发送选项,jquery,asp.net-mvc,http,asp.net-web-api,Jquery,Asp.net Mvc,Http,Asp.net Web Api,我遇到了一个非常奇怪的问题。下面的jQuery接收HTTP 405错误代码,并发送一个选项请求方法而不是GET function GetPerf() { jQuery.support.cors = true; leInterval = setInterval(function() { $.ajax({ url: "http://localhost/PerfMon3/api/performance/categories", data
function GetPerf()
{
jQuery.support.cors = true;
leInterval = setInterval(function()
{
$.ajax({
url: "http://localhost/PerfMon3/api/performance/categories",
data: { machine_name : "CLOUDMACHINE" },
type: "GET",
contentType: "application/json; charset=utf-8",
dataType: "json",
xhrFields: {
withCredentials: true
},
success: function (data) {
WriteResponse(data);
},
error: function (x, y, z) {
alert(data);
}
});
},
1000)
}
有趣的是,这在InternetExplorer中运行得非常好,但ChromeI得到了405。有人知道发生了什么事吗
补充说明:
无论使用何种浏览器,当从承载应用程序的IIS浏览器运行它时,它都可以正常工作。这个问题只会在远程机器上出现。好吧,我只是喜欢在询问之后通过自己的测试找到问题的答案。我很抱歉,伙计们 我将jQuery中的url行更改为
url: "http://cloudmachine/PerfMon3/api/performance/categories"
现在它工作得非常好
然而,为什么它最初只在IE中工作?这没有道理