You can't return the response from the outer function because the inner
function completes asynchronously.
I would probably wrap the PE in some kind of higher-level object, such that
a response of 100% stops it from running. I can probably whip up a quick
example if you want.
On Wed, May 28, 2008 at 12:04 AM, PAOEGONVG <[EMAIL PROTECTED]> wrote:
>
> I have a ajax request in a function like so:
>
> em = function(url)
> {
> var percent;
> new Ajax.Request(url,
> {
> method: 'get',
> onSuccess: function(transport)
> {
> var Bar = $('emBar');
> percent = transport.responseText;
> Bar.setStyle({ width: percent + '%' });
> }
> });
> }
>
> And then I have another function that has a PeriodicalExecuter that
> runs the first function.
> The problem is I can't figure out how to make it so the first function
> returns the percent variable so that the PeriodicalExecuter will stop
> when it hits a certain number.
--
Science answers questions; philosophy questions answers.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---