I have problem when i try to make an ajax request to a controler's function. (Codeigniter
)
Each time i make a request i get this error message:
Blocking a multi-origin request (Cross-Origin Request): the "Same Origin"
policy does not refer to the remote resource on http: //localhost/test.php.
Reason: CORS header "Access-Control-Allow-Origin"
I tried to add this in the top of php script (controler):
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: POST");
But this not solved the problem ... when i use it in an external php script (Not codeigniter script) this work well.
Did you have an idea about how to solve this issue ?
Or another approch to send ajax request ?
This question related to codeigniter, not same with pure php code.