I'm upgrading from rails 2.3.8 to 3.0.0, so I need to replace the remote_form_for helper calls with form_for(@object, :remote=>true).
I've been following along with Simone Carletti but I cant seem to get the ajax callbacks from rails.js to fire.
My generated HTML is:
The javascript I'm testing with:
jQuery(function($){
alert('document ready');
$("#formname")
.bind('ajax:loading', function() {alert("loading!");})
.bind('ajax:success', function(data, status, xhr) {alert("success!");})
.bind('ajax:failure', function(xhr, status, error) {alert("failure!");})
.bind('ajax:complete', function() {alert("complete!");});
});
The 'document ready' alert fires, and the ajax request is successfully executed (data is posted to the server), but none of the 'ajax:____' callbacks fire.
What am I doing wrong?
(for what it's worth, the form itself is loaded via ajax)
在将Rails从2.3.8升级到3.0.0的过程中,遇到远程表单(remote_form_for)替换为form_for(@object, :remote => true)后,AJAX回调无法触发的问题。尽管请求成功执行,但ajax:loading, ajax:success, ajax:failure 和 ajax:complete 等回调均未响应。已尝试使用jQuery绑定这些事件,但只有'documentready'生效。
143

被折叠的 条评论
为什么被折叠?



