Call php server side with Ionic and AngularJS

0

Hello everyone. I have this doubt of the title that I still can not heal. I've looked for several shapes and even the conventional angular shape:

  

$ http.post () or $ http.get ()

But I return this error:

  

Response to preflight request does not pass access control

In Access-Control-Allow-Origin header is present on the requested resource

Thanks for any help!

    
asked by anonymous 11.06.2017 / 16:52

1 answer

1

This is a CORS issue.

link

It happens when a request is made to your PHP API from a different domain from it, in this case, from your application using Ionic.

To resolve this, your PHP API needs to have the CORS headers set up. This setting will depend on the PHP framework you are using to create the APIs.

Below is an article on how to do it using Laravel.

link

    
13.06.2017 / 22:29