ajax里怎么添加跳转地址,Ajax中window.location.href无法跳转的解决办法
生活随笔
收集整理的這篇文章主要介紹了
ajax里怎么添加跳转地址,Ajax中window.location.href无法跳转的解决办法
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
$("#myForm").submit(function(){
$.ajax({
cache: true,type: "POST",url: "/BasketBall/user/validate",data:$('#myForm').serialize(),// 你的formid
async: false,error: function(request) {
alert("Connection error");
},success: function(data) {
if(data == "false"){
window.location.href="/BasketBall/index2.html";
}else if (data == "true"){
alert("賬號或密碼錯誤")
}
}
});
return false;
一般情況下要加上:return false
總結
如果覺得編程之家網站內容還不錯,歡迎將編程之家網站推薦給程序員好友。
本圖文內容來源于網友網絡收集整理提供,作為學習參考使用,版權屬于原作者。
總結
以上是生活随笔為你收集整理的ajax里怎么添加跳转地址,Ajax中window.location.href无法跳转的解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: macOS自带Python2.7删除之后
- 下一篇: mysql-5.7中的innodb_bu