title: Render XML document (obtained through ajax call) to a new window
body: <p>Hi I'm looking for a way to render an XML document, that I retrieve using ajax, to a new browser window. </p>
  
  <p>I am using JQuery's ajax() function to post JSON data to an MVC controller. The controller returns XML as a string. </p>
  
  <p>I am using window.open() to create a new window in javascript and set the documents content by calling.</p>
  
  <pre><code>newwindow.document.clear();
  newwindow.document.            
  newwindow.document.write(jqXHR.responseText);
  newwindow.document.close();
  </code></pre>
  
  <p>(Where jqXHR.responseText is the XML returned from the ajax() call.)</p>
  
  <p>The new window opens as expected and if I view source on the page I see my XML. BUT (you knew one was coming) nothing appears in the browser window. Obviously if I save the page source to disk and open the output is rendered as expected.</p>
  
  <p>Can anyone suggest a solution? 
  Just to re-iterate my main goal is to render an XML document (obtained through ajax call) to a new window.</p>
  
  <p>I should also add that I would like to see the output transformed by an XSLT. My XML has this processing instruction.
  Many Thanks</p>
  
  <p><strong>Edit</strong>--------------------------- THE SOLUTION I WENT WITH -------------------------</p>
  
  <p>Thanks for everyone's comments and suggestions. </p>
  
  <p>The solution that I ended up going with was to have a form with target="_blank" I then wrote the JSON to the form as a hidden field, and posted it to my controller which returned the XML (constructed from the JSON). When the XML was returned from the response the browser marked it up as expected. I guess this is not an answer to the original question. But Gabby has a solution below.</p>