ajax执行成功后可以跳转到另一个页面吗
4 回答

POPMUISE
TA贡献1765条经验 获得超5个赞
是可以的。
12345678910 例如:
$.ajax({
type:
"post"
,
url:url,
data:{xxx:xx},
dataType:
"json"
,
success :
function
(data){
window.location.href=
"跳转的url,后边也可以拼接点data中数据作为参数"
;
}
});
1 如果是需要跳转到另外的页面,也可以用window.open(url);

不负相思意
TA贡献1777条经验 获得超10个赞
可以,在ajax里面的success函数里面写window.location.href=url来实现跳转,或者直接在后台跳转,比如在后台的node.js里面,你可以用res.redirect(url)来实现

弑天下
TA贡献1818条经验 获得超8个赞
当然可以了:
$.ajax({
url:'xxx',
success:function(data){
//这里是执行成功之后要走的地方
window.location.href="跳转的页面";
}
});
添加回答
举报
0/150
提交
取消