$http No Access-Control-Allow-Origin problem in Ionic Php


$http No Access-Control-Allow-Origin problem in Ionic Php : If you are working with ionic you may face the cross domain access problem. I wasted more than one our to fix this problem in ionic. Actually in my case this problem was from the REST api which was written in php. I fixed this problem as below-


$http No Access-Control-Allow-Origin problem in Ionic Php

Add the following code of line in .php ie. in Rest php file. I added the below lines in the stating of rest php file and it solved my problem.

:

<?php
 header('access-control-allow-origin: *');
 header('Content-Type: application/json');
// your rest api goes here....
?>

The above solution solved my problem.


Advertisements

Add Comment

📖 Read More