ruby - How to submit a form and use the result in javascript triggered by the submit button? -
i have form_tag
form want submit in order values. these same values want use in javascript triggered same submit button use form.
what want first submit form , call javascript.
submit function looks that:
<%= submit_tag "submit", :onclick => "sendrequesttorecipients(); return false;" %>
but calls javascript , doesn't submit form.
if this:
:onclick => "submit();sendrequesttorecipients(); return false;"
submit form don't call javascript.
can somehow "trigger javascript after form submitted(using result of submission)?
my javascript looks that:
function sendrequesttorecipients() { { options } , requestcallback); }
the problem return false prevents default action of submit button.
try:
<%= submit_tag "submit", :onclick => "sendrequesttorecipients();" %>
Comments
Post a Comment