title: Cross-site AJAX requests
body: <p>I need to make an AJAX request from a website to a REST web service hosted in another domain.</p>
  
  <p>Although this is works just fine in Internet Explorer, other browsers such as Mozilla and Google Chrome impose far stricter security restrictions, which prohibit cross-site AJAX requests.</p>
  
  <p>The problem is that I have no control over the domain nor the web server where the site is hosted. This means that my REST web service must run somewhere else, and I can't put in place any redirection mechanism.</p>
  
  <p>Here is the JavaScript code that makes the asynchronous call:</p>
  
  <pre><code>var serviceUrl = "http://myservicedomain";
  var payload = "&lt;myRequest&gt;&lt;content&gt;Some content&lt;/content&gt;&lt;/myRequest&gt;";
  var request = new XMLHttpRequest();
  request.open("POST", serviceUrl, true); // &lt;-- This fails in Mozilla Firefox amongst other browsers
  request.setRequestHeader("Content-type", "text/xml");
  request.send(payload);
  </code></pre>
  
  <p>How can I have this work in other browsers beside Internet Explorer? </p>