On 29 Sep 2011, at 15:51, Richard Quadling wrote:

> Does ALL the JS work take place inside the onSuccess callback?
> 
> The "Back in JS" bit has to be part of the onSuccess callback
> otherwise it will happen out of sequence. The A in AJAX is potentially
> the hiccough here.

That's what I suspected but yes, all the 'back in JS' stuff does indeed happen 
in the onSuccess. (I also tried onComplete, but got the same result.) I think 
the problem may be that the div, inevitably, is replaced right at the end of 
the process (at the end of the onSuccess), and only then is the offending <img> 
tag unleashed, calling either the image itself or my little php script... but 
then I'd have thought preloading it might help, but it doesn’t seem to. I also 
tried loading it via a php exec() call to the image script in advance of 
returning the output string to JS, but that didn’t help.

What also convinces me that you're right about the A in AJAX is that when, for 
testing, I put a sleep(5) in the image script - which should hold it up by a 
whole 5 seconds - the div is still replaced immediately. When I first load the 
page (which also calls this script), I get a broken image icon where the image 
should have been, replaced after 5 seconds by the image, but when the div is 
replaced by the ajax call that doesn’t happen - I just get no change of image 
as before.

It really would be /so/ nice if I could get this working! It's for a 
password-protected CMS, so the world at large will never get the benefit, and I 
could simply reload the whole page instead of just the one div, but it's become 
a challenge!

-- 
Cheers... Chris
Highway 57 Web Development -- <http://www.highway57.co.uk/>

-- 
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com.
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en.

Reply via email to