-1

I am using ionic framework and angular js, I use chrome for viewing my logs but here I am doing a login page I am trying to post the user entered data to serve but I am getting this error like -

XMLHttpRequest cannot load - Response for preflight has invalid HTTP status code 405.

My code works fine on a device but I am getting the error in chrome. Anyone know the root cause of this error.

Vikrant
  • 4,922
  • 16
  • 46
  • 68
  • http://stackoverflow.com/questions/41861105/handling-cors-issues-in-ionic . Hope the above link will resolve your issue. Its because of cross orgin issue. – Ajay Apr 26 '17 at 06:59
  • Corrected subject and formatted question. – Geeky Ninja Apr 26 '17 at 11:51

2 Answers2

1

Cross-Origin Resource Sharing actually specifies that two requests should be made to the server on an AJAX call (if certain conditions apply, like sending custom headers).

The first request (the one with the OPTIONS method) is called pre-flight and is used to check if it's safe to send the full request to the server. The response from the server should contain a valid Access-Control-Allow-Origin header containing the URL of the client or *.

scary_devil
  • 318
  • 3
  • 18
0

HTTP 405 means Method Not Allowed. You may be sending the request with a different method on chrome. If you try the URL directly in browser it triggers a GET request on that URL.

Master Po
  • 1,123
  • 13
  • 34