Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Success callback on $http.post in AngularJS using Firefox

I have a simple CORS AJAX call from within AngularJS application with success callback:

$http({method:'POST',url:"http://0.0.0.0:4567/authenticate", 
 params: {Lusername:scope.Lusername,Lpassword:scope.Lpassword}})
 .success(function(){alert("Success")})

When used in Safari it works fine: returns expected JSON object and shows the alert box. However in Firefox, although the JSON object is returned properly the success callback is not triggered.

Any idea why?

like image 406
kwicher Avatar asked Nov 13 '22 03:11

kwicher


1 Answers

Make sure you handle the OPTIONS request in the server. If it returns 404 then Firefox wont call the next request (in your case the POST mentioned above).

like image 59
Pablo Avatar answered Nov 15 '22 10:11

Pablo