I'm facing a seemingly simple issue that I can't seem to find a clear solution for anywhere. Essentially, I have a JavaScript application hosted on a server that requires passing information between the JS app and a Rails-built server. The process involves the JS app triggering a function on the server to generate certain values, and then receiving these values back to be utilized in the JS app. This communication loop continues throughout the entire session of the application.
Is there a straightforward way to achieve this? I understand that Ajax plays a role in it, but I'm struggling to piece together how.