Ajax redirect if return false

Ajax redirect if return false

I have all the code done for the login and session done now I want on each page that requires the user to be logged in to check and if false redirect.

class.php

  1.     public function check_session() {
  2.       session_start();
  3.       if (isset($_SESSION['user_id'])) {
  4.         return true;
  5.       }
  6.       else {
  7.         return false;
  8.       }
  9.     }

session.php

  1. <?php

  2.       /* Includes */
  3.       include 'database.php';
  4.       include 'class.php';

  5.       $session = new Session($pdo);
  6.       if($session->check_session()) {
  7.             return true;
  8.       }
  9.       else {
                return false;
           }
session.js

  1. /*
  2. Redirect if not logged in
  3. */
  4. $('document').ready(function() {
     $.ajax({
      type : 'POST',
      url  : 'dist/php/session.php',
      data : data,
      success :  function(response) {
       if(response=="true"){
       }
       else{
        window.location.href="log-in.html";
       }
      });
     });
    });

It is not redirecting so what is wrong?