【发布时间】:2018-07-06 20:18:40
【问题描述】:
我已经从 ajax 成功方法获得结果,在该方法上我已经重定向到另一个页面,但它总是阻止我不允许显示以下错误。
page 405 method not allowed
如何解决这个问题欢迎任何建议我需要重定向到所需的页面。
这是我试过的:
function callinsert(db, tbl, pk, jobj) {
$.ajax({
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Bearer " + at);
},
url: "MYURL/Insert?database=" + db + "&tablename=" + tbl + "&pk=" + pk,
contentType: 'application/json',
data: jobj,
dataType: "json",
async: false,
type: "POST",
success: OnSuccessInsertEmployee,
/*Create a Function to run the Success Action */
error: errorAction
});
}
function OnSuccessInsertEmployee(data) {
//Here I need to redirect to another page
location.href = "xxxx.html";
}
【问题讨论】:
-
尝试window.location.replace(xxxx.html) OR window.location.href = "xxxx.html"
-
这也不行,兄弟我已经试过了..
标签: javascript ajax asp.net-web-api