Skip to content

Instantly share code, notes, and snippets.

@stefanbc
Created March 25, 2013 11:17
Show Gist options
  • Save stefanbc/5236463 to your computer and use it in GitHub Desktop.
Save stefanbc/5236463 to your computer and use it in GitHub Desktop.
Cross Domain Ajax
<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept');
?>
@jcsrb
Copy link

jcsrb commented Mar 25, 2013

why not from the .htaccess ? Header add Access-Control-Allow-Origin "*" ?

@stefanbc
Copy link
Author

stefanbc commented Apr 4, 2013

It could have been done from htaccess as well but in my case the file that was supposed to have this was called with ajax and somehow the htaccess wasn't taking it into consideration without this two headers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment