2

I am trying to do both: call a controller action and react to onclick with a javascript function. At the moment, I only can do one thing. Trying with

<%= button_to 'Call Action', contoller_action_path, :remote => true,
              :method => 'post',
              :onclick => "setSomeJsState('Run'); return(false);" %>

it triggers only the onclick part. Any ideas? Thanks in advance, devyn

Vasfed
  • 18,013
  • 10
  • 47
  • 53
devynF
  • 25
  • 3

1 Answers1

0

return false in js event disables event propagation, and thus rails ujs code to handle button does not run.

Other option is to make an $.ajax call to the action in setSomeJsState function.

Vasfed
  • 18,013
  • 10
  • 47
  • 53