OK, figured it out, so Ill answer my own question in case it is use full for some one else. 

There is no "onCreate" during ajax calls. Only onLoading, onLoaded, onInteractive, or onComplete.

so I changed the OnCreate line to:

onLoading: function() { loadingRequest('mc_loader', 'maincontent'); },

And we are now working. :) 



______________________________________________________________________

Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com 




On 16-Jun-06, at 10:32 AM, Alex Duffield wrote:

I am trying to get a loader to display during ajax requests, but the "onCreate" is not getting triggered. The onComplete does.


function loadComponent(section){
values = arguments[1]
pars = $H(values).toQueryString()
pars = "section="+section+"&"+pars
var url = '';
var ComponentLoader = new Ajax.Updater('maincontent', url, {
asynchronous:true,
onCreate: function() { loadingRequest('mc_loader', 'maincontent'); },
onComplete: function() { completedRequest('mc_loader', 'maincontent'); },
method: 'post',
parameters: pars,
evalScripts: true });
}

function loadingRequest(loader, target)
{
   alert("request started");
   new Effect.Appear($(loader), {duration: 0.5});
   $(target).style.display = "none";
}

function completedRequest(loader, target)
{
   alert("request Done");
  new Effect.Fade($(loader), {duration: 0.5});
   new Effect.BlindDown($(target));
}

Can any one see what I am doing wrong?

______________________________________________________________________
Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com 



_______________________________________________
Rails-spinoffs mailing list

_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to