title: Jquery Ajax post success/error function
body: <p>I'm trying to implement the following code, which run successfully, but blows right through the success function. I put an alert in there which shows only for an instant, but the following jquery message call does not appear. (message function works in other instances on the same page).</p>
  
  <p>Using jquery 1.6.</p>
  
  <p>Any idea why the code is not executing as it should? Thanks!</p>
  
  <pre><code>$(document).ready(function(){
     $('#postride').submit(function() {
  
       dataString = $("#postride").serialize();
       $.ajax({
          type: "post",
          url: "postride.php",
          data:dataString,
          error: function() {
              alert('error!');
              $(".message").text('An error occurred');
              $(".message").fadeIn("slow");
              $(".message").delay(2000).fadeOut(1000);    
          },
          success: function () {
              alert('success!');
              $(".message").text('Your post has been completed');
              $(".message").fadeIn("slow");
              $(".message").delay(2000).fadeOut(1000);    
              setTimeout( function() { top.location.href="view.php" }, 3000 );    
          }
       })
      });
  });
  </code></pre>