title: Rails 3, IE9 Jquery fileupload - no callbacks are triggered
body: <p>Title says it all, tried more ways than I can remember and I still can't get my callbacks to trigger. I'm using Rails 3.0.7 and Jquery 1.6, as well as latest jquery-fileupload plugin. </p>
  
  <p>I've followed the recommendations of a <a href="https://stackoverflow.com/questions/19300804/jquery-file-upload-not-firing-done-callback-in-internet-explorer-ie9">few</a> of the <a href="https://stackoverflow.com/questions/5388893/ie9-json-data-do-you-want-to-open-or-save-this-file">most relevant</a> SO links to try and debug this, and so far at least I am able to send the file into Rails. However, when the response is returned IE9 refuses to do anything meaningful with it. Here's what I'm doing: </p>
  
  <p>Rails view: </p>
  
  <pre><code>&lt;form class="file_upload" action="/search/via_uploaded_file" encType="multipart/form-data" method="post" accept-charset="UTF-8"&gt;
    &lt;div style="margin: 0px; padding: 0px; display: inline;"&gt;
      &lt;input name="utf8" value="✓" type="hidden"&gt;
      &lt;input name="authenticity_token" value="whatevs"&gt;
    &lt;/div&gt;
    &lt;input id="uploaded_file" name="uploaded_file" type="file"&gt;
    &lt;input id="fileupload" name="commit" value="upload" type="submit"&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>rendering in rails controller: </p>
  
  <pre><code>render :json =&gt; data_to_form.to_json, :content_type =&gt; 'text/html'
  </code></pre>
  
  <p><code>fileupload</code> code:</p>
  
  <pre><code>$("#fileupload").fileupload
    dataType: 'json' #have tried with and without this 
    add: (e, data) -&gt;
      data.submit() #this will 'force' the submit in IE &lt; 10 (not in my case)
    done: (e, data) -&gt;
      console.log('data')
      #foobaz
    fail: (e, data) -&gt;
      console.log('fail')
    always: -&gt;
      console.log(data)
  </code></pre>
  
  <p>I know what you may be thinking - aha! He's adding the <code>fileupload</code> js onto the submit button! However, if I don't do this IE9 simply refuses to do anything (nor to grab the filepath). Here are the headers that get generated: </p>
  
  <p><a href="https://i.stack.imgur.com/rGbzf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rGbzf.png" alt="Headers that are sent"></a></p>
  
  <p>and here's the response: </p>
  
  <p><a href="https://i.stack.imgur.com/8Jq3P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8Jq3P.png" alt="response headers"></a></p>
  
  <p>What's crazy is that even though I respond in rails as a <code>text/html</code> (knowing that the iFrame request for IE doesn't know about xmlhttp, and that <code>fileuploader</code> is expecting a JSON because I added it as a <code>dataType</code> option) all I get back is a new page with the response body: </p>
  
  <p><a href="https://i.stack.imgur.com/OUrMf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OUrMf.png" alt="resulting page"></a> </p>
  
  <p>What am I doing wrong? I've spent days pondering over this and you will make my day by pointing me in the right direction. Thanks in advance!</p>