我想轉換此爲Rails 3轉換form_remote_tag來的form_for爲Rails 3 UJS
<%= form_remote_tag :url => feedback_url,
:update => 'flash_message',
:before => "doSomething()",
:condition => "condition()",
:complete => "doSomethingElse();" -%>
這裏是我到目前爲止
<%= form_tag feedback_url, :remote => true, :id => 'form' do %>
<%# Gather data %>
<% end -%>
<script>
$(function() {
$("#form").bind("ajax:beforeSend", function() {
doSomething();
}).bind("ajax:success", function() {
doSmomethingElse();
});
});
});
</script>
看起來你很好。你有什麼特別的麻煩嗎? – coreyward
':condition'和':update'選項。 – maletor
在此示例中,表單ID'feedback_form'和jQuery選擇器'#form'不匹配。 – tfentonz