Ajax Post Request Returns JSON but Deferred Fails

Posted by imrane on Stack Overflow See other posts from Stack Overflow or by imrane
Published on 2012-12-19T23:01:44Z Indexed on 2012/12/19 23:02 UTC
Read the original article Hit count: 238

I have a cross-domain POST request to http://api.local/user/auth - my API endpoint. I allow Cross Domain requests in my api with CORS. Using Chrome if that makes a difference.

I get a valid server JSON response with 200 Status Code but I am using deferreds from a backbone model like so:

@model.save()
  .fail(-> console.log 'sync fail')
  .success ->
    console.log 'sync OK'

And I consistently get a 'sync fail' instead of the expected 'sync OK'

Thoughts?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about JSON