title: Can I use XMLHttpRequest on a different port from a script file loaded from that port?
body: <p>I have website that use XMLHttpRequest (jQuery, actually). I also have another site running on the same server, which serves a script file that makes XHR requests back to THAT site, ie.</p>
  
  <p><strong><a href="http://mysite:50000/index.html">http://mysite:50000/index.html</a></strong> includes</p>
  
  <pre><code>&lt;script src="http://mysite:9000/otherscript.js"&gt;&lt;/script&gt;
  </code></pre>
  
  <p>and <strong><a href="http://mysite:9000/otherscript.js">http://mysite:9000/otherscript.js</a></strong> includes</p>
  
  <pre><code>$.ajax({
      url: 'http://mysite:9000/ajax/stuff'
  });
  </code></pre>
  
  <p>The problem is - this doesn't work. The AJAX requests from the loaded script simply fail with no error message. From what I've been able to find this is the old same origin policy. Given that I control both sites, is there anything I can do to make this work? The "document.domain" trick doesn't seem to do a thing for XMLHttpRequest.</p>