Possible Duplicate:
jquery doesn’t call success method on $.ajax for rails standard REST DELETE answer
I respond to a remote-link (data-remote="true" data-type="json") and output
format.json { head :ok }
in my Rails (3.2.6) controller, which creates this header:
Status Code:200 OK
...
Connection:keep-alive
Content-Length:1
Content-Type:application/json; charset=utf-8
Server:thin 1.4.1 codename Chromeo
Set-Cookie: ... path=/; HttpOnly
X-UA-Compatible:IE=Edge
...
In my JavaScript file ajax:complete is triggered and outputs 200 (data.status).
$( '#myElement' ).on( 'ajax:complete', function( e, data ) {
console.log( data.status );
});
data looks like this:
...
readyState: 4
responseText: " "
setRequestHeader: function ( name, value ) {...
state: function () {...
status: 200
statusCode: function ( map ) {...
statusText: "OK"
...
Looks pretty good to me...
The problem
Instead of ajax:success, jQuery (jquery-ujs) executes ajax:error and I have no idea why since no error is given.
I have looked into alot of discussions, but this way always seemed to be the solution, not the problem. Thank you for any help!