ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
192 stars 187 forks source link

No ‘Access-Control-Allow-Origin’ header is present on the requested resource while accessing php rest api but header code already added #344

Closed judhisahoo closed 6 years ago

judhisahoo commented 6 years ago

Note: If you are having problems formatting your issue please refer to this article on using markdown in Github:

https://guides.github.com/features/mastering-markdown/

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Short description of the problem:

getting bellow message from chrome console with "ionic run android -l" command with real device..

ionic.bundle.js:19346 GET http://www.example.com/login/app_scripts/user_login.php?userid=userid&pass=123456789 501 (Not Implemented)

:8100/#/login:1 Failed to load http://www.example.com/login/app_scripts/user_login.php?userid=userid&pass=123456789: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://192.168.2.149:8100’ is therefore not allowed access. The response had HTTP status code 501.

But it is working fine with plucker..

What behavior are you expecting?

expecting success to call rest api.

Steps to reproduce:

  1. fired : ionic run android -l from windows command prompt..
  2. login screen appear and after enter user id and passwrod getting bellow error message from console.
insert any relevant code between the above and below backticks

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

Which Ionic Version? 1.x or 2.x

Plunker that shows an example of your issue

For Ionic 1 issues - http://plnkr.co/edit/Xo1QyAUx35ny1Xf9ODHx?p=preview

For Ionic 2 issues - http://plnkr.co/edit/me3Uk0GKWVRhZWU0usad?p=preview

Run ionic info from terminal/cmd prompt: (paste output below)