impromptu isnt closing dialog when close method called inside function

920 Views Asked by At

I am stuck for 4 hours with such code:

$.loader = function (msg) {
    jQuery.prompt.close();
    $.prompt(msg, { buttons: { }, show: 'fadeIn', promptspeed: 50, overlayspeed: 'fast' });
}

function my_function() {
   jQuery.prompt.close(); 
   $.loader('saving..');
   $.ajax({ 
    type: "POST",
    url: dir + "save.php",
    data: form,
    success: function(html){
                 jQuery.prompt.close(); 
                 $.loader('loading..')
                 $.ajax({ 
             type: "POST",
             url: dir + "load.php",
             data: form,
             success: function(html){
                         jQuery.prompt.close(); 
                     }
            }
    })
}

$('#next').live('click', function () {
    $.loader('processing..');
    my_function()
})

Task is easy. After clicking on #next it should first show dialog box with 'processing' dialogbox, later should close it and show 'saving'. After ajax succesfull call it should load new data with 'loading' dialogbox, and then dissapear. Everything works perfect except one thing driving me crazy - dialogbox with 'loading' text appears after load although i use jQuery.prompt.close() at the end. I am fighting with that for 4 hours and i have enough.. please help... what am i doing wrong? I use jquery 1.7.1.

EDIT: I found a solution. Not a real one, but it solves my problem: I found that impromptu uses .jqimessage class to get a text shown in dialogbox. Instead of making new object and later destroying it i make it once and destroy it afterwards. In a meantime i change just a message in .jqimessage box. Works all good - it looks that easiest ways are the best :) Thanks for help.

0

There are 0 best solutions below