Working with ajax on a rails 3.1 app, i need to be able to submit an ajax form (with remote: true) using a link rather than a submit button.
what do i need to do to the link (or the form) to make it submit as ajax rather than a normal form submit? I have tried adding onclick java to the link, but in each case it simply submits the form in a non-ajax way (page refresh).
The ajax form currently works fine with using a submit button, so it’s got to be something small…
Thanks!
When you create a form with
:remote => truethe Ajax event is bound to the submit button of the form. You must use javascript to trigger that event. Here is some code I used to accomplish something similar: