David Newkerk

Joined

10 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in jQuery UJS Callbacks Discussion

Thanks for the great tip. I wanted to post a small correction, since I made the same mistake myself at first. On the jQuery UJS ajax events page on github, you copied the "extra parameters" for the ajax:error event into your event listener, however in each case you need to also include "event" as the first parameter (I think the way the documentation describes this is confusing... you have to read the * text below). When you don't include event as the first parameter, you're actually looking at the event object when you console.log xhr, and likewise when you console.log status, you are actually looking at the xhr object, not status. So the corrected version would be $(document).on "ajax:error", (event, xhr, status, error) ->
Hope this helps!