This is probably a really dumb question with a simple answer but…
I am working on a project where I need to use AJAX to send/receive information. I am using Ruby on Rails (which I am pretty new to), but rather than using the helper methods or the built in functionality in the ‘defaults’ Javascript file, I need to do this manually in my own Javascript.
I believe that ultimately I will want to send a request with a JSON object, then have the controller return another JSON object containing the requested information.
The problem is that I cannot seem to find the syntax for sending something to a specific controller method, with parameters, directly from Javascript – everything I Google ends up being tutorials for using the Rails AJAX helper methods.
if using
jQueryis an option for you,jQuery.ajaxwill solve your problem.[and for those who likes to say jQuery is not solution for everything, i know that. i’m just giving him an option].