The 'Access-Control-Allow-Origin' header has a value that is not equal to the supplied origin
<p>I am trying to login with ajax to an API and I get this error:</p>

<blockquote>
  <p>XMLHttpRequest cannot load. The 'Access-Control-Allow-Origin' header
  has a value that is not equal to the supplied origin. Origin
  '<a href="http://localhost" rel="noreferrer">http://localhost</a>' is therefore not allowed access.</p>
</blockquote>

<p>I read all about this error, all over the internet, and I've tried all the solutions I could find online. I modified the .htaccess and apache httpd configuration file according to the CORS instructions here: <a href="http://enable-cors.org/server_apache.html" rel="noreferrer">http://enable-cors.org/server_apache.html</a></p>

<pre><code>Access-Control-Allow-Origin: *
</code></pre>

<p>Nothing seems to be working. I'd really appreciate if you guys can help me out with this. Thank you!</p>