views:

19

answers:

1

For some weird reason, the event "load" and even the option "success" from ajaxOptions got sort of a problem (or feature).

When I click on a tab, while the tab load the content thru AJAX I wanted to pop up an dialog, and when it's DEFFINITLY done, to close the dialog.

I dont know why but, the dialog is closing as soon as the ajax find out that the page exists...that kinda suck when it take a while for your page to load.

Heres my code:

    $("#tabs").tabs({
  select: $('#dialogLoadingData').dialog('open'),
  ajaxOptions: {
    success: function() {
      $('#dialogLoadingData').dialog('close')
    }
 }
});
+1  A: 

You need an anoymous function there, like this:

$("#tabs").tabs({
  select: $('#dialogLoadingData').dialog('open'),
  ajaxOptions: {
    success: function() {
      $('#dialogLoadingData').dialog('close')
    }
 }
});

Also, as @Fosco noted in comments, success also needs a typo fix.

Nick Craver
I thought it worked only for the first time
ale
This work for the first time, but does not works for any other tabs, and when i go back to the first tab, it does not popup the dialog
ale
@ale - It's doing that because when it's not in an anonymous function it executes immediately and tries to set the *result* of that as the handler.
Nick Craver