我正在通过 rails 提交表单,并且响应带有 200 个 OK 标头。我的完整事件会触发,但成功或失败都不会触发。有任何想法吗?
JS:
$('form#booking-email').bind('ajax:complete',function(){
alert('complete');
});
$('form#booking-email').bind('ajax:success',function(){
alert('success');
});
$('form#booking-email').bind('ajax:failure',function(){
alert('failure');
});
我的控制器
respond_to do |format|
format.json { head :ok }
end
响应:
Status: 200 OK
Cache-Control: max-age=0, private, must-revalidate
Connection: Keep-Alive
Content-Length: 1
Content-Type: application/json; charset=utf-8
Date: Sat, 03 Nov 2012 01:00:11 GMT
Etag: "7215ee9c7d9dc229d2921a40e899ec5f"
Server: WEBrick/1.3.1 (Ruby/1.9.2/2012-02-14)
Set-Cookie: _myeasybnb_session=BAh7CEkiD3Nlc3Npb25faWQGOgZFRkkiJWQ3NTE2ODMzZjMyY2RhZTU1NjAwMzk3MWIyYjdhZDMzBjsAVEkiEF9jc3JmX3Rva2VuBjsARkkiMTFNN1hvWGhUdytSSjVRcCtrdWFLVTk5NnBEQWF5QXVxRlR2L1pwV1JjUmM9BjsARkkiGXdhcmRlbi51c2VyLnVzZXIua2V5BjsAVFsISSIJVXNlcgY7AEZbBmkGSSIiJDJhJDEwJEJ3Uy5lTzI3Ly4xY05xWlhGZzJ3cy4GOwBU--bd4de54c468e9cedc322949bba91adb5a60bb92f; path=/; HttpOnly
X-Request-Id: 0bb75d4727fbe149b868214f39763030
X-Runtime: 2.183082
X-UA-Compatible: IE=Edge