title: Error 'Illegal Invocation' while trying to convert javascript to jquery
body: <p>I am trying to convert some code from javascript to jquery.</p>
  
  <p>Javascript Code: (I have got this code <a href="http://ajeeshms.in/Blog/Article/1/upload-files-using-ajax-in-asp-mvc" rel="nofollow">here</a>)</p>
  
  <pre><code>window.onload = function () {
      document.getElementById('uploader').onsubmit = function () {
          var formdata = new FormData(); //FormData object
          var fileInput = document.getElementById('fileInput');
          //Iterating through each files selected in fileInput
          for (i = 0; i &lt; fileInput.files.length; i++) {
              //Appending each file to FormData object
              formdata.append(fileInput.files[i].name, fileInput.files[i]);
          }
          //Creating an XMLHttpRequest and sending
          var xhr = new XMLHttpRequest();
          xhr.open('POST', '/Home/Upload');
          xhr.send(formdata);
          xhr.onreadystatechange = function () {
              if (xhr.readyState == 4 &amp;&amp; xhr.status == 200) {
                  alert(xhr.responseText);
              }
          }
          return false;
      }
  }
  </code></pre>
  
  <p>JQuery Code: (According to my application)</p>
  
  <pre><code> $('#AutoUploadFiles').click(function () {
  
          var formdata = new FormData();
          var fileInput = $("#AutomaticUploader");
  
          for (var i = 0; i &lt; fileInput.get(0).files.length; i++) {
              formdata.append(fileInput.get(0).files[i].name, fileInput.get(0).files[i]);
          }
  
          $.ajax({
              url: '/members/AutoUploadFile',
              type: 'post',
              data: formdata,
              success: function () {
  
              },
              error: function () {
  
              }
          });
      });
  </code></pre>
  
  <p>When I try to execute the above JQuery code I get 'Illegal Invocation' error in jquery.min.js file.</p>
  
  <p>I am new to Web Programming, so I might have done some mistakes while converting to JQuery.
  If anybody catches some mistake, please guide me.</p>