tcaine-hJ3xlndM57OWzc88wn+gRje48wsgrGvP@public.gmane.org
2006-Apr-07 19:09 UTC
Ajax.Updater asynchronous => false
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
