Why do I get error domain is not a suffix of localhost?
<p>I've read about origin policy etc and as I understand it you should put origin policiy domain on the client and on the server.</p>

<p>Ok lets say I have this code on <code>example.com</code> and I want to fetch info from the page <code>doyouknoweverything.doyouknoweverything.com/recordOfMyLife</code> with jQuery/ajax</p>

<pre><code>&lt;div id="sk"&gt;Loading...&lt;/div&gt; 
&lt;script&gt;
document.domain = "{example.com}";
$( "#sk" ).load( "http://whatever.doyouknoweverything.com/recordOfMyLife" );
&lt;/script&gt;
</code></pre>

<p>If I understand this correctly I can do like this in the php-file <code>whatever.doyouknoweverything.com/recordOfMyLife</code>:</p>

<pre><code>header("Access-Control-Allow-Origin: *");
</code></pre>

<p>Is this correct?</p>

<p>Why do I get error domain is not a suffix of localhost? I guess I don't understand and it is probably something very easy for you guys who have done this before...</p>