I am using PHP and AJAX. I have login form and after entering login details and clicking on the submit button then my ajax not working. I am getting
500 Internal Server Error.
when I click on the submit button.
Screenshot of the console
Would you help me out with what I missed in this?
$(document).ready(function() {
  var isReqInprogress = false;
  $("#loginform").validate({
    rules: {
      username: {
        required: true
      },
      password: {
        required: true
      }
    },
    submitHandler: function(form) {
      //form.submit();
      if (isReqInprogress) {
        return;
      }
      isReqInprogress = true;
      $.ajax({
        url: "process.php",
        type: "POST",
        dataType: "json",
        data: $('#loginform').serialize(),
        success: function(data) {
          if (data.error == "true") {
            window.location = "list.php";
          }
          isReqInprogress = false;
        },
      }); // AJAX Get Jquery statment
    }
  });
});<form method="post" id="loginform" action="" name="loginform">
  <input type="text" name="username" placeholder="USER NAME" class="input-field form-control box-shadow">
  <input type="password" name="password" placeholder="PASSWORD" class="input-field form-control box-shadow">
  <input type="hidden" name="action" value="loginform">
  <input type="submit" name="login" value="Login" class="w-btn w-btnbg-red" />
</form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/jquery.validate.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.19.1/additional-methods.min.js"></script>Process.php
<?php 
    ob_start();
    session_start();
    ini_set('display_errors', 1);
    require_once'connection.php';
    $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
    switch ($action) {
        case 'loginform' : loginform($conn); break;
        default : header('Location: entry-form.php'); 
    }
    function loginform($conn){
        echo "working";
    }
?>

 
    