Hi Folks,

I'm wondering if there is a way to get a function to wait until an
external Ajax.Request has completed.  As always, I find an example is
the best way to describe my issue:

var buildPage = {};
buildPage = Class.create();
buildPage.prototype =
initialize: function() {
this.RS = [];//hold json data for later use
_getData : function(a) {
var url = (a==1) ? 'url1' : 'url2';
new Ajax.Request (url), {method:'get',
onSuccess  : function(transport){
    this.RS = transport.responseText.evalJSON();
    if (a==1) this._drawPage;
_drawPage : function () {
//parse this.RS data with template
_refreshData : function () {
//wait until _getData reports success then continue

So this buildPage class reuses the _getData method calling a different
URL depending on what is passed to it.  What I want the _refreshData
method to do is call the _getData method, and only when it has
successfully refreshed the RS array, call the _drawPage method.

Is this possible? should I be doing it a different way?

Many thanks

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 
For more options, visit this group at 

Reply via email to