title: Submit AJAX Post onchange
body: <p>I'm trying to figure out why this isn't working, I don't want to have a submit button to click, It does work if I have one though, instead I use <code>onchange="this.form.submit()"</code> and that posts the form as it normally would, not AJAX background style, I didn't code the ajax part, I found it and made it work for my situation, but as far as I know <code>$('#ajaxform').submit(function ()</code>, submit is submit? Why isn't <code>onchange="this.form.submit()"</code> and <code>&lt;input type="submit" /&gt;</code> the same type of submit? What am I missing?</p>
  
  <pre><code>    &lt;form method="post" action="~/getAJAX.cshtml" id="ajaxform" name="form"&gt;
          @* -------- Div to hold form elements -------- *@
          &lt;div class="reportDateDiv"&gt;
  
              @* -------- Text --------- *@
              &lt;a class="blackColor fSize18 RPtxt"&gt;Reporting Period&lt;/a&gt;
  
              @* -------- Start day box -------- *@
              &lt;input type="text" name="inputDate" spellcheck="false" class="datepickerS metricDateTextbox capitalFirst"
                    onchange="this.form.submit()" value="@inputDate" autocomplete="off" placeholder="@placeholderStartDate.ToString("MMM d, yyyy")" readonly="readonly" /&gt;
  
              @* -------- Text --------- *@
              &lt;a class="blackColor fSize16 RPtxt RPtxtTo"&gt;to&lt;/a&gt;
  
              @* -------- End day box --------- *@
              &lt;input type="text" name="endDate" spellcheck="false" class="datepickerE metricDateTextbox capitalFirst"
                    onchange="this.form.submit()" value="@endDate" autocomplete="off" placeholder="@noEndDate.ToString("MMM d, yyyy")" readonly="readonly" /&gt;
  
          &lt;/div&gt;
      &lt;/form&gt;
  
      &lt;script type="text/javascript"&gt;
          $('#ajaxform').submit(function () { // catch the form's submit event
              $.ajax({ // create an AJAX call...
                  data: $(this).serialize(), // get the form data
                  type: $(this).attr('method'), // GET or POST
                  url: $(this).attr('action'), // the file to call
                  success: function (response) { // on success..
                      $('#here').html(response); // update the DIV
                  }
              });
              return false; // cancel original event to prevent form submitting
          });
      &lt;/script&gt;
  </code></pre>