Hi I am using the laravel authentication system which is out of the box but I want a behavior in which the user could redirect to his last page after login with user data. For logged in I using bootstrap validator
My login code in js file
function do_login() {
frm_name = 'userlogin';
email = $('#userlogin input[id=email]').val();
password = $('#userlogin input[id=password]').val();
_token = $('#userlogin input[id=_token]').val();
if (email == '' || password == '') {
$('#flashMessage').attr('class', 'alert alert-danger');
$('#flashMessage').html('Please specify Email and Password');
} else {
var param = 'email=' + email + '&password=' + password + '&_token=' + _token;
$.ajax({
type: "POST",
datatype: "json",
url: "/auth/login",
data: param,
success: function (data) {
if (data.status == 0) {
$('#loginModal').modal('hide');
window.location.href = '/';
}
if (data.status == 1) {
$('#flashMessage').attr('class', 'alert alert-danger');
$('#flashMessage').html(data.message);
} else {
onError(data.Error, '#' + frm_name);
}
}
});
}
}
$(document).ready({
$('#login').click(function () {
do_login();
});
});
So how can I managed the user could redirect to his last page after login using js. Thanks