I just ran into this very problem myself. Yes, this is a bug in prototype.
If you look in the code you will see that the relevent handlers and
callbacks simply aren''t called with a synchronous request (onComplete
is
similarly not called).
I submitted a patch <http://dev.rubyonrails.org/ticket/4657> over at
dev.rubyonrails.org which fixes this behavior. If you decide to check it
out drop a comment on the patch as to whether it works for you.
Peter
>
> Message: 4
> Date: Fri, 7 Apr 2006 12:09:57 -0700 (PDT)
> From: tcaine-hJ3xlndM57OWzc88wn+gRje48wsgrGvP@public.gmane.org
> Subject: [Rails-spinoffs] Ajax.Updater asynchronous => false
> To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> Message-ID:
>
<Pine.LNX.4.64.0604071148360.30797-eWylsx51Z4Ul4r0ALNDTjYlpRXitfTS6h13vi7wywA4@public.gmane.org>
> Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
>
>
> I was just working on a project where I needed to use Ajax.Updater with a
> synchronous request. It appears like all one would need to do is set the
> asynchronous option to false. I tried this and noticed that the content
> was being requested synchronously but the content was never injected into
> the DOM tree like one would expect from Ajax.Updater.
>
> In order to get the content returned by XmlHttpRequest inserted into the
> DOM tree, I had to call updateContent() on the Ajax.Updater instance,
> which happens automatically when using asynchronous requests.
>
> Asynchronous Version:
>
> new Ajax.Updater(
> some_id,
> url,
> { onComplete: function () { alert("update completed"); } }
> );
>
> Synchronous Version:
>
> var updater = new Ajax.Updater(
> some_id,
> url,
> { asyncronous: false }
> );
>
> updater.updateContent();
>
> alert("update completed");
>
> Does anyone know if having to call Ajax.Updater.updateContent() explicitly
> is a bug or a feature when making synchronous Ajax.Updater requests?
>
> Thanks,
> Todd
>
>
> **********************************************
>
--
Three passions, simple but overwhelmingly strong, have governed my life: the
longing for love, the search for knowledge, and unbearable pity for the
suffering of mankind.
--Bertrand Russell
_______________________________________________
Rails-spinoffs mailing list
Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs