Error function not invoked in AJAX using Jquery
<pre><code> $("#submit").click(function(){
    $.ajax({
       type: "POST",
       url: "session.php",
       data: "name=John123&amp;location=Boston",
       success: function(a, msg2){
          $('#feedback').removeClass().addClass('success').text(a +' '+msg2).fadeIn('slow');

       },

         error: function(a, b, c){
              $('#feedback').removeClass().addClass('error').text('This is' +b).fadeIn('slow');
           },
</code></pre>

<p>I'm trying to invoke error function using the following code in PHP:</p>

<pre><code>if ($_POST['name'] != "John") {
        $message['error'] = true;
        $message['message'] = "Hmm, please enter a subject in the subject field.";

        echo json_encode($message);
}
else
{
    echo $_POST['name'];
}
</code></pre>

<p>But I'm always getting success function invoked. Is there any way i can get error function invoked.</p>
