title: jQuery TypeError: 'undefined' is not a function on AJAX submit
body: <p>Does anybody see a problem with the following?</p>
  
  <pre><code>jQuery(document).ready(function($) {
      $("#ajax-form").submit(function(e) {
          e.preventDefault();
          $("#result").html('Sending…').fadeIn();
          var fields = '{';
          $('#ajax-form').filter(':input').each(function() {
              fields = fields + $(this).attr("name")+' : '+$(this).val()+', ';
          });
          fields = fields + '}';
          url = '/scripts/form-submit.php';
  
          $.post(url,fields, function(data, respText, xhr){
              alert('ok-'+data+'-'+respText+'-'+xhr);
          })
          .error(function(d) {
              alert('no good');
          });
      });
  });
  </code></pre>
  
  <p>In Inspector, I get the following error on submit:</p>
  
  <blockquote>
    <p>TypeError: 'undefined' is not a function (near '....error(function(d) {...')</p>
  </blockquote>
  
  <p>on the line that closes .error ( <code>});</code> ).  That's line 17.</p>
  
  <p>On submit I get one alert which reads: "<code>ok--success-[object XMLHttpRequest]</code>". The script I'm submitting to is supposed to send an email and return "It worked" as AJAX response data, and the email is never sent nor is the response received. I know the script works, because when I post do it regularly (not asynchronously), it all works perfectly.</p>
  
  <p>Any insight is very appreciated.  Thanks.</p>