Page 1 of 1

Ajax cross domain issues solved easily with PHP

Posted: Sun Jun 28, 2015 12:06 am
by doctorlai
In PHP you set the following:

Code: Select all

  header("Access-Control-Allow-Origin: *");  


before

Code: Select all

header('Content-Type: application/json');


so that ajax code on different domains can still use the APIs.

Of course, there is other options such as JSONP (only GET is allowed) or directly modify the apache settings.