Friday, May 10, 2024
 Popular · Latest · Hot · Upcoming
129
rated 0 times [  135] [ 6]  / answers: 1 / hits: 17011  / 14 Years ago, thu, february 24, 2011, 12:00:00

I've implemented this 'locksubmit' plugin http://blog.leenix.co.uk/2009/09/jquery-plugin-locksubmit-stop-submit.html where it changes the display state of the button to disabled.
I then want the form to be delayed by a few seconds before posting to the form URL.



What would I have to add in or modify to delay the form post once the user has clicked the submit button?



Thanks!


More From » jquery

 Answers
9

Cancel the default form submit behaviour, and start a timeout at the same time:



$('form').submit(function (e) {
var form = this;
e.preventDefault();
setTimeout(function () {
form.submit();
}, 1000); // in milliseconds
});


This should be compatible with the locksubmit plugin.



See a demo here: http://jsfiddle.net/7GJX6/


[#93601] Tuesday, February 22, 2011, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kalynnkathrynd

Total Points: 273
Total Questions: 101
Total Answers: 93

Location: Nauru
Member since Thu, Feb 2, 2023
1 Year ago
;