On Thursday 01 March 2007 14:48, Graham wrote:
> Hi folks. So far I have managed to  get dataloading into a div froma
> php script. This script just passes the time on the server in a div to
> the javascript below. I am trying to get the last loaded data to call
> Effect.Highlight but it seems to highlight the 2nd last data instead.
> Can anyone see what's going wrong here? I've tried everywhere to solve
> this.
> Check the code in action here http://gramac4.freeserverhost.com/test.php.

Hi Graham,

Just had a quick look at this in Firebug. It looks like all your DIV tags are
coming back with an ID of 'test'. so the Effect is just going to go for the 
first
one with that name. Looks like a race condition is underway here - although the
updateContent() gets called before onComplete(), the first time the Effect is
invoked, the content hasn't been rendered yet, so it selects the previous one.

If you increment the id of the div each time (test_1, test_2) etc., you'll avoid
this kind of confusion - or you could pass the id of the incoming DIV to be
highlighted as an X-JSON header, maybe?

HTH

Dave

-- 
----------------------
Author
Ajax in Action http://manning.com/crane
Ajax in Practice http://manning.com/crane2
Prototype & Scriptaculous in Action http://manning.com/crane3

--~--~---------~--~----~------------~-------~--~----~
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