I'm new to web development, so I hope this makes sense. I am using Ruby 1.8.7 and Sinatra. I set a variable in config.ru, like
$MyFile = "file.json"
Then I call an erb file, which uses that variable to open "file.json", get some data and display it. So far so good.
If the user activates a drop down on the page, my javascript code listens, and is supposed to re-load the page, but with $MyFile = "file2.json", thus the data displayed will be different. I can detect the change, and reload the page, however I don't know how to change the variable.
Is it possible to essentially call $MyFile = "file2.json" from javascript? Of course calling a Ruby function would be fine, too.
Again, I'm not real experienced at this stuff. I've read that AJAX may be needed, but I don't know anything about AJAX.