ajax里怎么添加跳转地址,Ajax中window.location.href无法跳转的解决办法
生活随笔
收集整理的這篇文章主要介紹了
ajax里怎么添加跳转地址,Ajax中window.location.href无法跳转的解决办法
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
$("#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("賬號或密碼錯(cuò)誤")
}
}
});
return false;
一般情況下要加上:return false
總結(jié)
如果覺得編程之家網(wǎng)站內(nèi)容還不錯(cuò),歡迎將編程之家網(wǎng)站推薦給程序員好友。
本圖文內(nèi)容來源于網(wǎng)友網(wǎng)絡(luò)收集整理提供,作為學(xué)習(xí)參考使用,版權(quán)屬于原作者。
總結(jié)
以上是生活随笔為你收集整理的ajax里怎么添加跳转地址,Ajax中window.location.href无法跳转的解决办法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: macOS自带Python2.7删除之后
- 下一篇: 低配服务器装那个系统吗,用低配服务器好还