JS跳转页面失效
1.在window.location.href的下一行加上window.event.returnvalue=false,扑捉到这个时间,随后判为false.
原理有待研究
function sub(info) {
var title = $(".title").text();
var content = $(".textarea").text();
var date = {"title": title, "content": content};
$.post("/submit/?id=" + info.id, date, function (date) {
alert(date);
});
window.location.href = "/index/?username=" + info.name + "&quanxian=1";
window.event.returnValue = false;
// return false;
}
2.在window.location.href下一行写return false,使游览器停止操作。
function sub(info) {
var title = $(".title").text();
var content = $(".textarea").text();
var date = {"title": title, "content": content};
$.post("/submit/?id=" + info.id, date, function (date) {
alert(date);
});
window.location.href = "/index/?username=" + info.name + "&quanxian=1";
//window.event.returnValue = false;
return false;
}