$.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;
}
The main code:
var forward = document.referrer;
if (forward == "" || forward == undefined || forward == null) {
location.href = "{:url('index/user/index')}";
} else {
location.href =""+ forward +"";
}
Source: Liu Juntao's blog welcome attention to public numbers, messages, comments, study together.
If it helps you, please click on the recommendation , your support is certainly the best I insisted (* ^ _ ^ *)