Thanks for the help TJ.  A couple things...

The code calls a function called cycle() on window load, which has the
request in it called once per second (using setTimeout(cycle(),
1000)).  That Ajax.Request is inside cycle().

I am not averse to moving the heavy lifting outside the Ajax.Request,
I will give that a shot.

I could not find any examples of how to easily take a bunch of
attributes on a JSON object and plop them in a page from the prototype
examples.  I was hoping somebody could point me in that direction, as
well.

As for the "Loading" text, the page this is served on will only
display that at program startup, as the backend giving up the data
will error out for a bit until a connection is made to a datasource.
So the failure will only happen in one case (except if my backend goes
down), but I can see situations where the text will be misleading.  It
is intentional for lack of better options.

Thanks!

On Mar 8, 11:16 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
> Oh, and forgot to say:  Do you *really* mean to be saying "Loading"
> when the load fails? ;)
>
> On Mar 8, 3:03 pm, abehrens <[EMAIL PROTECTED]> wrote:
>
> > Greetings
>
> > I have a javascript problem concerning a possible memory leak. I am
> > using Ajax.Request to get a JSON object from a server and then passing
> > the data from the JSON object to a few div's. This is done every
> > second, but over time it seems my code leaks somewhere (in the
> > browser).
>
> > I have racked my brain trying to figure this one out...can anyone tell
> > from this snippet what might be wrong:
> > new Ajax.Request('getData?time=' + dateTime,
> > {
> > method:'get',
> > onSuccess: function(transport){
> > var json = transport.responseText.evalJSON();
> > $('statusBanner').update();
> > $('Month1').update(responseJSON.Month1);
>
> > $('Month1V').update(json.Month1V);
> > $('Month2').update(json.Month2);
> > $('Month2V').update(json.Month2V);
> > $('Month3').update(json.Month3);
> > $('Month3V').update(json.Month3V);
>
> > $('L1V').update(json.L1V);
> > $('L2V').update(json.L2V);
> > $('L3V').update(json.L3V);
>
> > $('Spread1').update(json.Spread1);
> > $('Spread1V').update(json.Spread1V);
> > $('Spread2').update(json.Spread2);
> > $('Spread2V').update(json.Spread2V);
> > $('Spread3').update(json.Spread3);
> > $('Spread3V').update(json.Spread3V);
> > delete json;
>
> > },
>
> > onFailure: function(){
> > $('statusBanner').update("<h1>Loading</h1>");
>
> > }
> > });
>
> > Many many thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to