title: JQuery Form JSON response data NULL in Internet Explorer
body: <p>I am using <a href="http://malsup.com/jquery/form/" rel="nofollow noreferrer">Malsup's JQuery Form plugin</a> with Spring MVC to do some Ajax lookups.</p>
  
  <p>I am encountering an issue with IE (surprise surprise).</p>
  
  <p>Javascript Code:</p>
  
  <pre><code>var options = {
      type: "POST",
      cache: false,
      success: displayList,
      error: errorList,
      url: 'test.jsp',
      dataType: 'json'
  };
  
  $('form').ajaxSubmit(options);
  
  function displayPolicyList(responseText, statusText, xhr, $form)
  {
      alert(responseText); // Works in all browsers
  }
  
  
  function errorList(xhr, ajaxOptions, thrownError)
  {
      alert(xhr.responseText); // Fine in firefox etc, NULL in IE
  }
  </code></pre>
  
  <p>Spring Code:</p>
  
  <pre><code>@ResponseBody
  public ResponseEntity&lt;Map&lt;String, String&gt;&gt; erroResponse()
  {
      Map&lt;String, String&gt; error = new TreeMap&lt;String, String&gt;();
  
      error.put("error", message);
  
      HttpHeaders responseHeaders = new HttpHeaders();
      responseHeaders.setContentType(MediaType.TEXT_PLAIN);
  
      return new ResponseEntity&lt;Map&lt;String, String&gt;&gt;(error, responseHeaders,
                                                HttpStatus.INTERNAL_SERVER_ERROR);
  }
  </code></pre>
  
  <p>All works fine in all browsers on success. I can read and parse the JSON response without any issues. The problem arises when I return 500 with my error messages in the JSON response. In firefox, chrome etc, it all woks as expected and errorList can parse the JSON response.</p>
  
  <p>In IE however the JSON is null. I can see in the JQuery Form plugin that I receive the same cross origin error (<strong>cannot access response document: TypeError: Access is denied.</strong>
  ) detailed here:</p>
  
  <p><a href="https://stackoverflow.com/questions/12933868/access-is-denied-on-jquery-form-js-in-ie">Access is denied. on jquery.form.js in IE</a></p>
  
  <p>I am not however accessing cross domain as it is a single application.</p>
  
  <p>In the JQuery Plugin the block that seems to be the issue is:</p>
  
  <pre><code>function getDoc(frame) {
          var doc = frame.contentWindow ? frame.contentWindow.document : frame.contentDocument ? frame.contentDocument : frame.document;
          return doc;
      }
  </code></pre>
  
  <p>When I return HttpStatus.CREATED from the Controller it works fine, but any failure event from the server causes the above function to throw an exception.</p>
  
  <p>Any ideas?</p>