title: Redirect to new page as response to XHR post request
body: <p>I have no way to fix the javascript. The page uses a XHR</p>
  
  <pre><code>function openPOST(url, params, callback) {
          var xmlhttp = new XMLHttpRequest();
          xmlhttp.open("POST", url, true);
          xmlhttp.setRequestHeader('Content-Type', "application/x-www-form-rlencoded");
          xmlhttp.send(params);
          xmlhttp.onreadystatechange = function() {
              if (this.readyState === 4) {
                  if (xmlhttp.status === 200) {
                      if (callback) callback(this.responseText);
                  }
              }
          }
          return xmlhttp;
      };
  </code></pre>
  
  <p>At the time of page load, use the following query</p>
  
  <pre><code>document.addEventListener('DOMContentLoaded', function () {
          ...
          function go() {
              openPOST("/home/someaction", "query=123", function (count) {
                  document.querySelector("h1").textContent = count;
              });
          }
          ...
          go();
          ...
  });
  </code></pre>
  
  <p>Is it possible to implement such a code to ASP.NET MVC so he moved on to another page, but did not put the result in another page ?</p>
  
  <p>I need to POST requests are redirected to the page to a different address.</p>
  
  <p>the following code inserts the result in <code>document.querySelector("h1").textContent</code> </p>
  
  <pre><code>public void someaction() {
              Response.Status = "307 Temporary Redirect";
              Response.AddHeader("Location", "http://example.com");
          }
  </code></pre>
  
  <p><strong>EDIT:</strong>
  User opened an old version of our webpage in his browser. This webpage makes an ajax call to our webserver and inserts response as a string (no eval(), js code won't work). Is there are any way to reload this web page from our server?</p>