On 30 September 2011 10:27, Chris Sansom <ch...@highway57.co.uk> wrote:
> Right - time to deal with all these helpful answers I've been getting, but 
> first, to save time, let me say... it's fixed! And a very simple fix it was 
> too, which I /thought/ I'd already tried...
>
> On 29 Sep 2011, at 17:15, Richard Quadling wrote:
>> Create a test case where it goes wrong. Write new clean code that
>> doesn't want/need/use anything from the main project.
>
> I had just prepared such a project when I found the answer among the answers 
> below!
>
> And on 29 Sep 2011, at 18:04, Phil Petree wrote:
>> This is an interesting problem... my first reaction is that you'd want to 
>> use onComplete to update the div's instead of onSuccess.
>>
>> Test this with a couple of alerts and see which one gets called first and 
>> which is last (just as onCreate is the first call, onComplete is the last).
>
> Well I had already tried onComplete and it made no difference, but I tried 
> your suggestion nevertheless and sure enough, wherever I put the alerts in 
> the code of the callbacks, onSuccess always emerged before onComplete. It 
> also didn’t matter (as I assumed it wouldn't) if I put the onComplete before 
> the onSuccess in the code.
>
> Then on 29 Sep 2011, at 18:28, Phil Petree wrote:
>> This guy had a solution that worked for me:
>> http://www.irt.org/script/416.htm
>
> I had already tried using the time in a similar way to this, but it didn’t 
> work. However, in the same message...
>
>> I have also used the cheap trick of adding a random query string on to the 
>> end of the image url:
>> http://www.somedomain.com/images/newname.jpg?id=random_number and since this 
>> will always generate a new url, the browser will refresh the image.
>
> That was the one! As I say, I thought I'd done that - or something very like 
> it - in my numerous attempts at different solutions, but I obviously didn’t 
> do exactly this, and it seems to work reliably every time in a suitably 
> bulletproof fashion. So simple!
>
> It also seems to confirm that my initial suspicions were correct, and it is 
> after all a caching issue, not to do with, er, asynchronicity (if that's a 
> word - if not, Ive just invented it, so there).
>
> So many thanks for your time and thoughts, Richard and Phil, also ncubica and 
> Walter for chipping in.
>
> --
> 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.
>
>

onFailure / onSuccess is in response to a working result from the AJAX call.

onComplete is in response to the AJAX mechanism shutting down.

onComplete will always be called, but it isn't its job to deal with
the data from the call. That is onSuccess. If the call failed for some
reason, onComplete wouldn't have any data to work with and could make
things worse.

I use onCreate and onComplete to turn on/off a little spinner showing
that the app is doing something behind the scenes.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

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