1

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.

Kalreg
  • 931
  • 3
  • 12
  • 31
  • Perhaps the second ajax call for load.php never succeeds, eg, it gives you back a response other than 200? – Aadaam Aug 01 '12 at 00:01
  • it loads whole page and it is on the screen so it's surely ok – Kalreg Aug 01 '12 at 00:09
  • You sure? What does the debugger say? (Firebug / webkit developer) Have you tried to add breakpoints? I can't see any function which actually USES the data, maybe you didn't put it into your example? (html is NEVER used) – Aadaam Aug 01 '12 at 00:34

0 Answers0