lundi 31 juillet 2017

How to call a Javascript function in rails helper

I am new to rails. I have created a helper method with a loop. Inside the loop, I want to call a javascript function. Following is the code I have written. Any help would be appreciated. Helper method

def test_helper param1
   param1.each do |x|
     "js_function(x.col1, x.col2)"
   end
end

in javascript file test.js

function js_function(x1, x2){

}

Aucun commentaire:

Enregistrer un commentaire