Hello
One of my application pages needs to grab data from two different XMLRPC
endpoints – it’s kind of expensive sometimes. So I decided to load
that information using two separate ajax requests as the page loads.
In the view, it looks like this:
<%= image_tag "spinner.gif "%> <%= javascript_tag "var jira_loaded = false"%> <%= periodically_call_remote ( :update=> "jira_information", :frequency=>0, :url=>{:controller=>:person, :action=>:fetch_ajax_jira, :id=>@person}, :condition => "jira_loaded == false", :before => "jira_loaded = true") %>While this works, it bugs me because I know that in the background
Safari is constantly checking the jira_loaded condition. What I would
really like to do is to execute the request just once as the page loads.
I thought about writing some javascript to do this, registering an
onLoad event, and then pulling in the data myself, but I really don’t
want to do that if there is a railsy way to do it instead.
I looked for a call_remote tag, or something related to it that would
serve this purpose, to no avail.
Thanks for any help!