This seems really simple but I can't find a straightforward answer to this problem anywhere. Basically, I have a JavaScript application that is sitting on a server and it needs to pass information back and forth between the JS application and the server, which is built on Rails. First, the JS application needs to tell the server to execute a function that generates said values, and then it needs a way to get them back to the JS application so it can use them, and they communicate back and forth like this during any given session of the application.
Is there any easy way to do this? I realize Ajax is somehow involved but I can't figure out how.