jquery - Settimeout() not working synchronusly -


i have page submitbutton.when submit button clicked,i need show dialog box notification messages 2 seconds.after 2 seconds,i need redirect page location.

settimeout(function(){        $('#wrapper_dialog').dialog('close');                                                 }, 2000); //after popup closes,i need redirect page  window.location = "?load=parents/communication"; 

when this,dialog comes , page asynchronously leading next page.

settimeout(function(){ $('#wrapper_dialog').dialog('close');}, 2000).then(function(){     window.location = "?load=parents/communication";     }); 

this not working.

settimeout doesn't return promise, returns number; there's no then function available on it.

just put location assignment after call close dialog, within settimeout callback:

settimeout(function(){     $('#wrapper_dialog').dialog('close');                     window.location = "?load=parents/communication"; }, 2000); 

or if have animation on dialog close, put location assignment in close event of dialog:

settimeout(function(){     $('#wrapper_dialog').dialog('close').on("dialogclose", function() {         window.location = "?load=parents/communication";     });                 }, 2000); 

that wait change location until animation complete.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -