Jquery Ajax call with error handling



   $.ajax({
            url: 'errorlink.php',
            type: "GET",
            dataType: "json",
            data: {
                name: "John",
                location: "Boston"
            },
            error: function(jqXHR, textStatus, errorThrown) {
                alert('An error occurred... ');

                $('#result').html('

status code: '+jqXHR.status+'

errorThrown: ' + errorThrown + '

jqXHR.responseText:

'+jqXHR.responseText + '
'); }, success: function(data, textStatus, jqXHR) { $('#result').html(data); alert('Load was performed. Look at the console (F12 or Ctrl+Shift+I, Console tab) for more information! '); } });