jquery ajax GET 500 internal server error code example

Example 1: jquery ajax 500 internal server error php

// That mean you have error in server side
// A 500 error is not a problem with your JS - it s server-side
// Add this code at the top of your PHP:

ini_set('display_errors', 1); 
error_reporting(E_ALL);

// That will show you what the problem is in your PHP code. If it s a syntax error (seems quite likely for a code 500)

// Comment all code in your page PHP and make simple sentense " Hello this is my page " and test 
// if all good then find your error

Example 2: jquery ajax 500 error handling

$.ajax({
    statusCode: {
        500: function() {
          alert("Script exhausted");
        }
     }
});

Tags:

Php Example