I have a form of following structure
ROR code”
form_tag class='remote_form' remote=>true
{
some fields
1
2
3
one <a> link remote=>true
4
submit button
}
jquery code
$('.remote_form').live('ajax:beforeSend', function(event, elements){
do some blah blah
}
now when I click “one link” “blah blah” thing executes . why is that so ?
basically only when I click submit “blah blah” must get executed.
Have I done anything wrong ?
My idea :
The form contains a few elements . and before the form gets submitted I need to do a few things so I use ajax:before send for remote_form . Now I also have some link which is an ajax request totally independent of form.
Obviously the one link shouldn’t cause the execution of “blah blah “..
I’m not sure to understand. Your problem is that the callback is fired although the form hasn’t been submitted ?
Did you try with the classic $.ajax() function :