tags:

views:

20

answers:

1

Hello all,

I am working on the jQuery BlockUI Plugin and I like to adopt the style illustrated for iPhoto (ish) http://malsup.com/jquery/block/#demos.

I have designed the jQuery Form that will be submitted through aJax. Here is what I would like to do:

1> After the user clicks the submit button to fire up the form to server, I pop-up such a iPhoto (ish) dialog

2> When the aJax response event returns, then I unlock this dialog.

What should I do to achieve such a feature?

Thank you

+1  A: 

You can unblock the UI having it triggered on the .ajaxStop() event, like this:

$(document).ajaxStop(function() {
  $.unblockUI();
});

This would un-block the UI when the last AJAX request completes. If you haven't got the first portion, there's a matching .ajaxStart(), like this:

$(document).ajaxStart(function() {
  $.blockUI({ ...options... });
});
Nick Craver
The problem of this solution is that if there is another aJax event is fired on the form, then these handlers will be incorrectly triggered.Thank you
q0987
@q0987 - You can do the same thing in your own handler, before you call `.ajax()` and in your `success` handler for the unblock, is that what you mean?
Nick Craver