title: Jquery Ajax post success/error function
body: <p>I have a post function that is not being caught on error.</p>
  
  <p>Here's the value being returned from postride.php.</p>
  
  <pre><code>if ($group_id==0) {
  echo 'No group selected';
  return false;
  exit;
  }
  </code></pre>
  
  <p>Here's the jquery code:</p>
  
  <pre><code>$(document).ready(function(){
  $('#postride').submit(function(event) {
       event.preventDefault();
       dataString = $("#postride").serialize();
       $.ajax({
          type: "post",
          url: "postride.php",
          data:dataString,
          error: function(returnval) {
              $(".message").text(returnval + " failure");
              $(".message").fadeIn("slow");
              $(".message").delay(2000).fadeOut(1000);
          },
          success: function (returnval) {
              $(".message").text(returnval + " success");
              $(".message").fadeIn("slow");
              $(".message").delay(2000).fadeOut(1000);    
              //setTimeout( function() { top.location.href="view.php" }, 3000 );  
          }
      })
      return false;
  });
  </code></pre>
  
  <p>});</p>
  
  <p>The post function returns false, but the error function does not fire, only the success function. It will post "No group selected success".</p>
  
  <p>Thanks for any help!</p>