krunal shah
krunal shah

Reputation: 16339

How to call this function through RJS?

Function call from javascript

Test.show({title : "Text",body  : "Description" });

How can I call this function from RJS ?

page << "Test.show({title : "Text",body  : "Description" });"

page.call "Test.show", "{title : "Text",body  : "Description" }"

Any solution ?

Upvotes: 0

Views: 354

Answers (1)

Naren Sisodiya
Naren Sisodiya

Reputation: 7288

you need to escape " to form valid function call syntax, for this you can use ' single quote like

page << "Test.show({title : 'Text',body  : 'Description' });"

or

 page << %{ Test.show({title : "Text",body  : "Description" }); }

Upvotes: 1

Related Questions