出于某种原因,我无法使此代码生效,我正在尝试使用GET重新加载/刷新页面。我找到的所有示例代码都使用POST,但我不能这样做,因为我们的表单需要GET。
这是我的代码:
$.ajax({type: "GET",
url: "CorrectResults",
data: data,
beforeSend: function() {
console.log("Submitting Data");
},
cache: false,
success: function(html) {
document.location.reload();
//location.reload(true);
//$("#acceptDiv").html(html);
}
});
这应该是一个简单的方法来完成这个,为什么使用POST这么容易,而不是GET?
答案 0 :(得分:2)
我们走了:
$.ajax({type: "GET",
url: "CorrectResults",
data: data,
beforeSend: function() {
console.log("Submitting Data");
},
cache: false,
success: function(html) {
window.location.href= "../yourUrl";
}
});
希望它有所帮助;)
答案 1 :(得分:0)
如果您的脚本中没有任何其他错误(请在浏览器中按控制台按F12键),
然后你可以试试location.reload();
在你的成功方法中,如:
$.ajax({type: "GET",
url: "CorrectResults",
data: data,
beforeSend: function() {
console.log("Submitting Data");
},
cache: false,
success: function(html) {
location.reload();
}
});