Hi,
I want to call a Rails method from a JavaScript method using AJAX. Please help me.
Hi,
I want to call a Rails method from a JavaScript method using AJAX. Please help me.
You can't exactly "call" a Rails method from the front end. What you can do is have a controller method that renders JSON, and request the URL that routes to that controller method.
Returning JSON is fairly straightforward; you might use something like the syntax in this post: http://stackoverflow.com/questions/611931/render-json-does-not-accept-options