I like to setup 5 second interval after form submission, then redirect to different page.
here is html code:
<button type="button" id="submit">Submit</button>
Right now,I'm using this jquery for redirect onclick 5 second interval.
$('#submit').click(function(){
setTimeout(function(){
window.location.href='index.php';
},5000);
});
I changed .click(function() to .submit(function() but didn't worked.
is there have any way to set 5 second interval after submitting form?
Thank you.
Use preventDefault() to stop form submission and execute your code
$('#submit').on('click', function(e){
e.preventDefault();
setTimeout(function(){
window.location.href='index.php';
},5000);
});