title: JQuery plugin form - how to submit form using onchange event
body: <p>I am new to JQuery - I need to use the JQuery form plugin for a file upload but I would like to submit the form as soon as the file is selected (onchange event of the the input tag:myfile, as shown below), </p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
      &lt;form encType="multipart/form-data" method="post" action="file-echo.php" encoding="multipart/form-data" id='fileUploadForm'&gt;
          **&lt;input name="myfile" type="file"&gt;**
          &lt;input value="Upload File to Server" type="submit"&gt;
      &lt;/form&gt;
  
      &lt;div class="progress"&gt;
          &lt;div style="width: 0%;" class="bar"&gt;&lt;/div&gt;
          &lt;div class="percent"&gt;0%&lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div id="status"&gt;&lt;br&gt;&lt;/div&gt;
   &lt;/body&gt;
  &lt;/html&gt;  
  </code></pre>
  
  <p>I copied the following sample JS code from plugin website but I would like to adapt it so that the form is submitted upon selecting the file.  Any pointers please ?  thanks in advance.</p>
  
  <pre><code> $(document).ready(function(){
           $('#myfile').change(function(){
  
           // alert("");
         $('#fileUploadForm').ajaxForm({ 
              beforeSubmit: ShowRequest,
              success: SubmitSuccesful,
              error: AjaxError                               
            });
  
         });
  
        function ShowRequest(formData, jqForm, options) {
            var queryString = $.param(formData);
            alert('BeforeSend method: \n\nAbout to submit: \n\n' + queryString);
            return true;
          }
  
          function AjaxError() {
            alert("An AJAX error occured.");
          }
  
          function SubmitSuccesful(responseText, statusText) {        
            alert("SuccesMethod:\n\n" + responseText);
          }    
  </code></pre>