0

can anyone help me how to set time to auto redirect if my script is executing.

I want to have a timer because it will automatically redirect to the page and my confirmation popup dialog box close so fast.

current code:

<script>
$(document).ready(function() {
 // show a dialog box when clicking on a link
$.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                         'You have successfully registered!', {
                         'type':     'confirmation',
                         'title':    'Non-uniformed Personnel (NUP)',
                         'auto_close': 10000
                        });
window.location.replace("index.php");

});
</script>

4 Answers 4

1
setTimeout(function() {
    window.location.replace("index.php")
},5000);

This will set the location to replace in 5 seconds.

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

Comments

1

Try using setTimeout. Using setTimeout you can control the time duration after which you want to do any action.

Comments

1

May be you want something like this :

 <script>
$(document).ready(function() {
// show a dialog box when clicking on a link
$.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                      'You have successfully registered!', {
                      'type':     'confirmation',
                      'title':    'Non-uniformed Personnel (NUP)',
                      'auto_close': 10000
                    });
setTimeout(function(){       
 window.location.replace("index.php");
 },10000);

 });
</script>

Comments

1

Use setTimeout after the dialog

 $.Zebra_Dialog('<strong>Congratulations! </strong> <br> ' +
                         'You have successfully registered!', {
                         'type':     'confirmation',
                         'title':    'Non-uniformed Personnel (NUP)',
                         'auto_close': 10000
 });

setTimeout(function() {
    window.location.replace("index.php")
},10000);  //change the time value accordingly

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.