title: Data submit using jQuery AJAX
body: <p>I am submitting data using jQuery/AJAX in JSON format but the success function is not being hit.</p>
  
  <p>Here is my JavaScript:</p>
  
  <pre><code>function addOrder(accounts,profiles) {
      var ticker = $('#ticker').val();
      var Quatity = parseFloat($('#quantity').val()); 
      var lmtPrice = parseInt($('#price').val());
      var OrderType = $('#type').val();
      var Action = $('#action').val();
      var TIF = $('#tif').val();
      var url = rootURL+'/submit?account='+ accounts+'&amp;profile='+ profiles+'&amp;Ticker='+ ticker+'&amp;Quatity='+ Quatity+'&amp;lmtPrice='+ lmtPrice+'&amp;OrderType='+ OrderType+'&amp;Action='+ Action+'&amp;TIF='+ TIF;
  
      $.ajax({
          type: 'POST',
          contentType: 'application/json',
          url: url,
          dataType: "json",
          data: $('orderform').serialize(),
          /*data: dataString,*/
          complete : function(){
              alert(this.url)
          },
          success: function(data, textStatus, jqXHR){
              alert('Order created successfully');
          },
          error: function(jqXHR, textStatus, errorThrown){
              alert('Order error: ' + textStatus);
          }
      });
  }
  
  $('#btnSave').click(function() {
      addOrder(option,option2);
  });
  </code></pre>
  
  <p>Here is my HTML form:</p>
  
  <pre><code>&lt;form id="orderform"&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;Ticker:&lt;/div&gt;
        &lt;div class="col-md-8"&gt;&lt;input type="text" name="ticker" id="ticker" /&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;Quatity:&lt;/div&gt;
        &lt;div class="col-md-8"&gt;&lt;input type="text" name="quantity" id="quantity" /&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;lmtPrice:&lt;/div&gt;
        &lt;div class="col-md-8"&gt;&lt;input type="text" name="price" id="price" /&gt;&lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;OrderType:&lt;/div&gt;
        &lt;div class="col-md-8"&gt;
           &lt;select name="type" id="type"&gt;
              &lt;option&gt;MKT&lt;/option&gt;
              &lt;option&gt;LMT&lt;/option&gt;
           &lt;/select&gt;
        &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;Action:&lt;/div&gt;
        &lt;div class="col-md-8"&gt;
           &lt;select name="action" id="action"&gt;
              &lt;option&gt;BUY&lt;/option&gt;
              &lt;option&gt;SELL&lt;/option&gt;
           &lt;/select&gt;
        &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;TIF:&lt;/div&gt;
        &lt;div class="col-md-8"&gt;
           &lt;select name="tif" id="tif"&gt;
              &lt;option&gt;DAY&lt;/option&gt;
              &lt;option&gt;GTC&lt;/option&gt;
           &lt;/select&gt;
        &lt;/div&gt;
     &lt;/div&gt;
     &lt;div class="clearfix box"&gt;
        &lt;div class="col-md-4 righttext label"&gt;&amp;nbsp;&lt;/div&gt;
        &lt;div class="col-md-8"&gt;
           &lt;input type="submit" id="btnSave" value="submit" /&gt;
           &lt;!--&lt;button id="btnSave"&gt;submit&lt;/button&gt;--&gt;
        &lt;/div&gt;
     &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>The script always hits the error function when I hit the submit button.</p>