作者:曾静ZHH_423 | 来源:互联网 | 2023-10-11 16:34
Simplifying,inmyFirstpage,Ihavethis:简化,在我的第一页,我有:$(function(){check();})function
Simplifying, in my First page, I have this:
简化,在我的第一页,我有:
$(function () {
check();
})
function check() {
$.get("/MyController/MyAction/", function (data) {
if(data != undefined && data != "")
{
window.location.href = data;
}
})
}
this works well, but if the user comes back on the page (using browser go back button) the jquery get function doesn't reach to the controller and the data variable is blank. Why jquery get function doesn't execute my controller action? I have the same result using ajax:
这很有效,但是如果用户返回页面(使用浏览器返回按钮),jquery get函数将无法到达控制器,并且数据变量为空。为什么jquery get函数不执行我的控制器操作?使用ajax也有相同的结果:
$.ajax({
url: "/MyController/MyAction/",
})
.done(function (data) {
if(data != undefined && data != "")
{
window.location.href = data;
}
});
1 个解决方案