title: Jquery ajax post request not working
body: <p>I have a simple form submission with ajax, but it keeps giving me an error.  All the error says is "error". No code, no description. No nothing, when I alert it when it fails.</p>
  
  <p>Javascript with jQuery:</p>
  
  <pre><code>$(document).ready(function(){
  
          $(".post-input").submit(function(){
              var postcontent = $(".post-form").val();
  
              if (postcontent == ""){
                  return false;
              }
  
              $(".post-form").attr("disabled", "disabled");
  
              $.ajax({
                  url: '/post',
                  type: 'POST',
                  data: {"post-form": postcontent},
                  dataType: json,
                  success: function(response, textStatus, jqXHR) {
                      alert("Yay!");
                  },
                  error: function(jqXHR, textStatus, errorThrown){
                      alert(textStatus, errorThrown);
                  }
              });
          });
      });
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form class="post-input" action="" method="post" accept-charset="utf-8"&gt;
                  &lt;textarea class="post-form" name="post-form" rows="1" cols="10" onFocus="this.value='';return false;"&gt;What are you thinking about...&lt;/textarea&gt;
                  &lt;p&gt;&lt;input class="post-submit" type="submit" name = "post.submitted" value="Post"&gt;&lt;/p&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>and if there are no problems there, then the server-side (pyramid):</p>
  
  <pre><code>def post(request):
      session = Session()
      user = authenticated_userid(request)
      postContent = request.POST['post-form']
      if not postContent == '':
          session.add(Activity(user.user_id, 0, postContent, None, None))
          return {}
      return HTTPNotFound()
  </code></pre>
  
  <p>UPDATE:
  After some more debugging with firebug, I discovered that the post request body contains only post.submitted=Post, instead of the intended result of {"post-form": postcontent}.</p>