title: "No 'Access-Control-Allow-Origin' header is present on the requested resource." when making "GET" request
body: <p>I'm using an HTTP-request in order to get Google's autocomplete suggestions, here's what inspired me to do so:</p>
  
  <blockquote>
    <p>You can make a GET request to the following URL:</p>
    
    <p><a href="http://suggestqueries.google.com/complete/search?client=chrome&amp;q=cats" rel="nofollow noreferrer">http://suggestqueries.google.com/complete/search?client=chrome&amp;q=cats</a></p>
    
    <p>Where "client" param is your browser's name (works with most but you may pass >the same type disregarding what the user is currently on and it will still work).</p>
    
    <p>And "q" param is your search string.</p>
    
    <p>This will return you a list of suggested items which you can then put into a jQuery autocomplete plugin or build your own (you can't just get the whole >google dropdown interface to popup with a single function sadly :) )</p>
  </blockquote>
  
  <p>(src: <a href="https://stackoverflow.com/questions/41915398/add-google-autocomplete-to-google-search-bar?rq=1">Add Google autocomplete to Google search bar?</a>)</p>
  
  <p>I'm using this function to get Google's response text:</p>
  
  <pre><code>function httpGetAsync(theUrl, getGoogle){
     var xmlHttp = new XMLHttpRequest();
     xmlHttp.onreadystatechange = function() { 
        if (xmlHttp.readyState == 4 &amp;&amp; xmlHttp.status == 200)
           getGoogle(xmlHttp.responseText);
     }
     xmlHttp.open("GET", theUrl, true); // true for asynchronous
     xmlHttp.send(null);
  }
  </code></pre>
  
  <p>However, when the funtion is executed, CORS seems to prevent me from getting a response: <code>Failed to load http://suggestqueries.google.com/complete/search?client=chrome&amp;q=xx: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access.</code></p>
  
  <p>Is there a way of adding an 'Access-Control-Allow-Origin' header to the resource?</p>