$.ajax({

url: "login",

type: "post",

dataType: "json",

async: false,

data: {

'phone': $('#phone').val(),

'password': $('#password').val(),

},

success: function (data) {

if (data.code) {

$('#password').next().html(data.info);

return false;

} else {

var forward = document.referrer;

if (forward == "" || forward == undefined || forward == null) {

location.href = "{:url('index/user/index')}";

} else {

location.href = "" + forward + "";

}

return false;

}

主要代码:

var forward = document.referrer;

if (forward == "" || forward == undefined || forward == null) {

location.href = "{:url('index/user/index')}";

} else {

location.href = "" + forward + "";

}



若有帮助到您,欢迎点击推荐,您的支持是对我坚持最好的肯定(*^_^*)

你要保守你心,胜过保守一切。

作者:刘俊涛的博客​