The login is successful will return to the login page before

 

$.ajax({

          url: "login",

          type: "post",

          dataType: "json",

          async: false,

          data: {

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

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

          },

          successfunction (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 (* ^ _ ^ *)

Guess you like

Origin www.cnblogs.com/lovebing/p/12543999.html