On Oct 28, 8:24 am, Collin Vandyck
<rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:> 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 thepageloads.
>
> In the view, it looks like this:
>
> <span id="jira_information">
> <%= image_tag "spinner.gif "%>
> </span>
> <%= 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 toexecutethe request justonceas thepageloads.
> 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!
> --
> Posted viahttp://www.ruby-forum.com/.
Did you ever find a solution for this? I have the same problem: I
need something like a "call_remote" function.
I''ve put:
render :update do |page|
page.call ''scroll'', 0, 0
page.replace_html :campaign_errors, "ERRORS TEST"
end
into an action executed in response to a GET request and got back the
expected text/html response:
try {
scroll(0, 0);
Element.update("campaign_errors", "ERRORS TEST" );
} catch (e) { alert(''RJS error:\n\n'' + e.toString());
alert(''scroll(0,
0);\nElement.update(\"campaign_errors\", \"ERRORS
TEST"\");''); throw
e }
displayed, as expected, as text in the browser.
The question seems to boil down to how to call render :update in a xhr
request that returns text/javascript for execution by the browser?
Any ideas about this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---