title: XMLHttpRequest cannot load URL doesn't pass access control check: No 'Access-Control-Allow-Origin
body: <p>In my page i'm doing an ajax rest call to an external </p>
  
  <p>the url is formatted like this:</p>
  
  <pre><code>var url = "http://someurl.somedomain.com/WS/?SomeVariable=global&amp;SomeCOde="+code.val();
  </code></pre>
  
  <p>The url is generated after a submit event of a form.</p>
  
  <pre><code>$(document).ready(function(){
      console.log('ready!');
      $('#form').submit(function(event){
          event.preventDefault();
          var code = $('#code');
          if ( code.val() !== '' ) {
              var url = "http://someurl.somedomain.com/WS/?SomeVariable=global&amp;SomeCOde="+code.val();
              // Chiamata rest
              $.ajax({
                  url: url,
                  dataType:'xml',
                  crossDomain: true,
                  type: 'GET',
                  success: function(data, status, response) {
  
                  }
              });
          } else {
              code.css('outline', 'solid 1px red');
          }
      });
  });
  </code></pre>
  
  <p>I'm expecting from this call a XML response but in the console log it appear the error: </p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load
    <a href="http://someurl.somedomain.com/WS/?SomeVariable=global&amp;SomeCOde=xxxx" rel="nofollow">http://someurl.somedomain.com/WS/?SomeVariable=global&amp;SomeCOde=xxxx</a>.
    Response to preflight request doesn't pass access control check: No
    'Access-Control-Allow-Origin' header is present on the requested
    resource. Origin '<a href="http://www.someurl.it" rel="nofollow">http://www.someurl.it</a>' is therefore not allowed
    access.</p>
  </blockquote>
  
  <p>How can i resolve it?
  How can i set ajax after for a xml response?</p>
  
  <p>Thanks for all the help</p>