0

I have this for a success function:

success: function(data){
        $('#pleaseWaitDialog').modal('hide');
          data = $.trim(data);
          if(data == 'true'){
            $('#myTab a[href="#intro"]').tab('show');
          }
          else{
            $("#alert").attr('class', 'alert alert-warning');
            $("#alert").html('Your Pass Phrase was incorrect! Please try again.');
          }
      }

How do I delay the $('#pleaseWaitDialog').modal('hide'); from happening for 1200 milliseconds.

I've tried:

$('#pleaseWaitDialog').modal('hide').delay(1200);

But it did nothing.

0

6 Answers 6

0

you can use

setTimeout() function with parameters function you wanna call and time of delay in milliseconds.

like

 var timeout = setTimeout(function(){
      //codes here.
  },1200);

and

use clearTimeout(timeout); to stop the timeout.

Sign up to request clarification or add additional context in comments.

Comments

0

Please use setTimeout() to delay in JavaScript.

Comments

0

You can use the javascript setTimeout function. Like so..

setTimeout(function(){
    $('#pleaseWaitDialog').modal('hide')
},
1200);

This will do what you're asking. See here for more information.

Comments

0

put you code inside

setTimeout(function(){
      $('#pleaseWaitDialog').modal('hide');
  },1200);

Comments

0

You have to call .delay before calling .modal. See the example on jQuery API documentation page.

Comments

0

use setTimeout like this:

setTimeout(function(){
    $('#pleaseWaitDialog').modal('hide')
},
1200);

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.