I have a question After using PHP URL Routing my main.js file window.location.href
is not working every error message shows in console but redirect is not working how can solve it?
here are my codes
Routing.php
$request = $_SERVER['REDIRECT_URL'];
$router= str_replace('/','',$request);
// ROUTING FOR INDEX PAGE
if($router=='/' || $router=='/index'){
include('index.php');
}
// ROUTING FOR LOGIN PAGE
elseif($router=='/login'){
include('login.php');
}
JS CODE
function login_btn(){
jQuery('.input_error').html('');
var email=jQuery("#login_email").val();
var password=jQuery("#login_password").val();
var login_error='';
if(email==''){
jQuery('#login_email_error').html('Please enter your Email Address');
login_error='yes';
}
if(password==''){
jQuery('#login_password_error').html('Please enter Password');
login_error='yes';
}
if(login_error==''){
jQuery.ajax({
url:'login_process.php',
type:'post',
data:'email='+email+'&password='+password,
success:function(result){
if(result=='login_failed'){
jQuery('#login_message').html('<p class="alert alert-danger">Incorrect Email Address or Password</p>');
}
if(result=='success'){
window.location.href=window.location.href;
}
}
});
}
}
All errors are working but result is showing in console