I am using AngularJS on Rails in order to make a POST request to another webiste for authenticatng users' login. However, I received CORS error and got a 405 error.
What will be the best way to send a POST request on login in Rails?
I am using AngularJS on Rails in order to make a POST request to another webiste for authenticatng users' login. However, I received CORS error and got a 405 error.
What will be the best way to send a POST request on login in Rails?
This is happening as a security reason because your browser doesn't allow you to send ajax call on other domain.
But however you can achieve that using jsonp. You haven't provided your code sample so i can't say exactly but following should solve your problem :
//add ?callback=jsonp_callback after your url
// e.g my url is www.xyz.com/abc then
var url = "www.xyz.com/abc?callback=JSON_CALLBACK";
$http.jsonp(url).
success(function(data, status, headers, config) {
//success
}).
error(function(data, status, headers, config) {
//error
});