I am trying to redirect to Homepage from SignIn Page after the validation of user credentials is done. The response is working perfectly fine. On getting a successful response, I want to redirect to Homepage. I am using Javascript for client side and PHP on server side. but the success response is not getting to ajax.
Ajax call
$('#login-btn').click(function(e) {
if ($('#login-form')[0].checkValidity()) {
    e.preventDefault();
    $("#login-btn").html('<img src="images/tra.gif" /> Please Wailt..');
    if ($('#Lemail').val() == '') {
        $('#error-message').fadeIn().html('* Email is Required!');
        setTimeout(function() {
            $('#error-message').fadeOut('slow');
        }, 5000);
    } else if ($('#Lpassword').val() == '') {
        $('#error-message').fadeIn().html('* Please enter password!');
        setTimeout(function() {
            $('#error-message').fadeOut('slow');
        }, 5000);
    } else {
        $('#error-message').text('');
        $.ajax({
            url: 'actionlog.php',
            method: 'POST',
            data: $('#login-form').serialize() + '&action=login',
            success: function(response) {
                if (response === 'true') {
                    window.location = '../';
                } else {
                    $('#logAlert').html(response);
                }
            }
        });
    }
}
});
});
PHP code:
<?php
//Login Request
if (isset($_POST['action']) && $_POST['action'] == 'login') {
    if (Input::exists()) {
      $validate = new Validate();
      $validation = $validate->check($_POST, array(
        'email' => array('required' => true),
        'password' => array('required' => true)
      ));
      if ($validation->passed()) {
        $user = new User();
        //create Remember
        $remember = (Input::get('remember') === 'on') ? true : false;
        $login = $user->login(Input::get('email'), Input::get('password'), $remember);
        if ($login) {
          echo 'true';
        }
      }else{
        foreach ($validation->errors() as $error) {
          $user = new User();
          echo  $user->showMessage('danger',$error);
        }
        }
    }
      
}
please i need help
 
     
     
    