Im trying to allow CORS on a PHP server I have the following code
<?php
header('content-type: application/json; charset=utf-8');
header("access-control-allow-origin: *");
echo '<p>Hello World!!</p>';
?>
and a simple ajax request to fetch it using jquery
I keep getting this CORS error on my dev tools
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access.
I also used curl -i to check the response and im seeing it doesnt have the headers... what is wrong
curl -i
HTTP/1.1 200 OK Date: Mon, 31 Aug 2015 17:25:33 GMT
Content-Type: text/html
Content-Length: 97
Connection: keep-alive
Keep-Alive: timeout=30
Server: Apache/2
X-Powered-By: PHP/5.3.29
Cache-Control: private, pre-check=0, post-check=0, max-age=0
Expires: 0
Pragma: no-cache