title: Assigning callbacks for a $.post call in jQuery
body: <p>I have this script that works pretty well, but it keeps triggering the "error" callback, even though there is no error:</p>
  
  <pre><code>$(".comment-form").submit(function(e) {
      e.preventDefault();
  
      var $form = $(this),
          text = $form.find('textarea').val();
          url = $form.attr('action');
  
      $.post(url, { comment: text,
          beforeSend: function() {
              alert("before send");
          },
          error: function() {
              alert("error"); 
          },
          success: function(data) {
              alert(data);    
          }
      });
  });
  </code></pre>
  
  <p>Am I using the callbacks incorrectly here? Shouldn't the error callback fire only if there's an ajax error? </p>
  
  <p>My intention is react to the request. If it has an error, I want to do something. If it's successful, I want to do something else, etc...</p>