title: Error in file upload using Jquery & Ajax
body: <p>I am trying to upload files using jQuery and AJAX. I have used <code>FormData</code> object which is supported in HTML5. I am using IE11. Below is my code:</p>
  
  <pre><code>&lt;form id="tradeForm" method="post" action="/trade.action?method=addTrade" enctype="multipart/form-data"&gt;
      Trade Type : &lt;input type="text" id="tradeType" name="tradeType"&gt;
      Trade Document : &lt;input type="file" id="attachedFile" name="attachment" size="40"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I've tried using <code>$.post</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>$("#tradeForm").submit(function(event){
      event.preventDefault();
      var form = $(this);
      var formData = new FormData(form);
      url = form.attr("action");
  
      $.post(url, formData, function(data) {
          console.log(data);
      });
  });
  </code></pre>
  
  <p>And also using <code>$.ajax</code></p>
  
  <pre><code>$("#tradeForm").submit(function(event){
      event.preventDefault();
      var form = $(this);
      var formData = new FormData(form);
      url = form.attr("action");
  
      $.ajax({
          url: url,
          type: "POST",
          data: formData,
          processData: false,  // tell jQuery not to process the data
          contentType: false   // tell jQuery not to set contentType
      }).done(function(data) {
          console.log(data);
      });
  });
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <blockquote>
    <p>Argument not optional</p>
  </blockquote>
  
  <p>When <code>$.post</code> method is used </p>
  
  <blockquote>
    <p>SCRIPT7002: XMLHttpRequest: Network Error 0x2ef3, Could not complete the operation due to error 00002ef3 </p>
  </blockquote>
  
  <p>When <code>$.ajax</code> method is used. How can I solve these errors?</p>