Is it possible to call controller method from a javascript? I mean it's not from view(html.erb) also not from js.erb. I want to call method from .js file, which in public folder. Thank you
Yes, you want to do AJAX calls. You probably want to use jquery which would be simpler than straight javascript. Here is a link to a w3schools tutorial on jquery AJAX calls. Here is another SO post with a link to a gist with some example code or you may want to Google jQuery, AJAX and Rails 3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With