title: XMLHttpRequest cannot load "url". Origin null is not allowed by Access-Control-Allow-Origin
body: <p>I am trying to call a web service from javascript. In Internet Explorer 9 works properly, while chrome does not work. The error is as follows:</p>
  
  <p>"OPTIONS <a href="http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl" rel="nofollow">http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl</a> 400 (Bad Request)
  XMLHttpRequest cannot load <a href="http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl" rel="nofollow">http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl</a>. Origin null is not allowed by Access-Control-Allow-Origin."</p>
  
  <p>I leave the code for help me. Thanks.
  `
      
          
              function SOAPClient() {
                  this.wsdl = '';
                  this.async = true;
                  this.action = '';
                  this.xml = '';</p>
  
  <pre><code>            SOAPClient.prototype.invoke = function(){
                  var xhr;
                  if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                      xhr = new XMLHttpRequest();
                  } else {// code for IE6, IE5
                      xhr=new ActiveXObject("Microsoft.XMLHTTP");
                  }
  
  
                  xhr.onreadystatechange=function() {
                      if (xhr.readyState &gt;= 3){
                          alert ('ReadyState '+xhr.readyState+' - - Status '+xhr.status);
                          if(xhr.status == 200)
                              document.getElementById("txtResult").innerHTML=xhr.responseText;
                          else
                              document.getElementById("txtResult").innerHTML='Error';
                      }
                  }
                  xhr.open("POST", this.wsdl,this.async);
                  xhr.setRequestHeader("SOAPAction", this.action);
                  xhr.setRequestHeader("Content-Type", "text/xml");
                  xhr.setRequestHeader("Connection", "close");
                  xhr.send(this.xml);
                  return false;
              }
          }
      &lt;/script&gt; 
      &lt;script type="text/javascript"&gt; 
          var wsdl = 'http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl';
          var action = 'GetConversionRate';           
          var xml = '';
          var async = true;
          var response = '';
  
          function prueba(){              
              var client = new SOAPClient();
              client.wsdl = wsdl;
              client.action = action;
              client.xml = '&lt;soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.restfulwebservices.net/ServiceContracts/2008/01"&gt;&lt;soapenv:Header/&gt;&lt;soapenv:Body&gt;&lt;ns:GetConversionRate&gt;&lt;ns:FromCurrency&gt;EUR&lt;/ns:FromCurrency&gt;&lt;ns:ToCurrency&gt;GBP&lt;/ns:ToCurrency&gt;&lt;/ns:GetConversionRate&gt;&lt;/soapenv:Body&gt;&lt;/soapenv:Envelope&gt;';
              client.invoke();
              return false;
          }   
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;p&gt;Versión 2.5&lt;/p&gt;
      &lt;form name="form" action="#"&gt;
          Term: &lt;input type="text" name="inputValue" method="post"/&gt;
          &lt;button onclick="prueba()"&gt;Search&lt;/button&gt;
          &lt;p id="txtResult"&gt;&lt;/p&gt;
      &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>`</p>