I'm seeing some strange behaviour with my Rails3 app. Note that I'm using the jQuery version of rails.js
From rails.js
starting at line :49
error: function (xhr, status, error) {
el.trigger('ajax:failure', [xhr, status, error]);
alert('error in: ' + xhr.responseText );
}
From my jQuery code to execute after the form.
.bind('ajax:failure', function(xhr, status, error) {
alert('error in: ' + xhr.responseText );
})
In the alert in rails.js shows the expected return text, but the alert my callback shows:
error in: undefined
So it doesn't appear that xhr is being sent to the callback correctly. Am I doing something wrong, or is this an issue with rails.js
?
Further testing shows that this applies for both the ajax:failure
and ajax:success
callbacks. With the ajax:success
call back the server response is in status
, so I didn't notice the behavior.