well, what I want is document to be blocked before its ready.
and unblock when document is ready is finished

so before <body> I made a

<script>
   $('body').block();

</script>

and at the end of the document ready

$('body').unblock()

it works, but I wonder if there is something i missed?


best.

On Feb 2, 11:11 am, Ricardo Tomasi <ricardob...@gmail.com> wrote:
> the 'onload' event actually fires after document ready - that's the
> reason doc ready exists!
>
> What you want is to block *on* doc ready, and unblock after your ajax
> stuff is finished. As ajax is asynchronous, you'll have to keep track
> of every call to know when everything is done.
>
> $(document).ready(function(){
>
>   $.blockUI({ message: null });
>   var count = 0,
>   ajaxCount = function(){
>       count++;
>       if (count == 5) //total number of ajax calls
>          $.unblockUI();
>   });
>
>   $('xis').load('bla.py', function(){
>      //bla bla
>      ajaxCount();
>   });
>   $.ajax({ etc etc, success: function(){
>     //blablabla etc etc
>     ajaxCount();
>   });
>   ... and so on..
>
> });
>
> On Feb 1, 10:57 pm, cambazz <camb...@gmail.com> wrote:> Hello,
>
> > I would like to blockUI on body onload like:
>
> > <body onload="$.blockUI({ message: null });">
>
> > and when document ready finishes unblock, but unfortunately i can not
> > unblock it if I put blockUI on onload of body.
>
> > My page makes few ajax calls and some processing on document ready,
> > and i want to blockUI until page finishes loading completely.
>
> > Is there a solution, or a workaround?
>
> > Best.

Reply via email to