How to make the script send the data to the server over 3000 ms?





Submit

July 9th 19 at 10:14
1 answer
July 9th 19 at 10:16
On JS.
Execute an AJAX request through setinterval 3000:
setTimeout(ajaxFunc,3000);
And you can write more in detail, I have a problem, there is button type="submit" in the form of this button I have a animation when pressed, but she doesn't have time to work because of the instant send data to the server, I need first did the animation on this button, and then there was sending the data, and reloading the page - Carey commented on July 9th 19 at 10:19
This can be implemented in different sposobami. But let's say.
You have a button:
and the function itself:
var submitFunc = function(btn){
btnAnimate(btn); // this is a snapshot of your functionality animation
setInterval(ajaxFunc,3000); // this call through the MS 3000 sending options request
}


But it works if you are sending via AJAX, if sending a standard POST request from the html that doesn't work, modify to AJAX. - Nathaniel79 commented on July 9th 19 at 10:22
Quarrels, forgot the button code to invest:
<input type="submit" onclick="submitFunc(this);"> - Nathaniel79 commented on July 9th 19 at 10:25
Another time, a little mistake write setInterval instead of setTimeout - Nathaniel79 commented on July 9th 19 at 10:28
: damn, my upload goes from HTML, I just want to put a delay on sending the forms that would have time to go through the animation that starts when you press this button, and then there was reloading the page - Carey commented on July 9th 19 at 10:31
The essence of the sending of the HTML in order to send data to the server as mono faster. Other here can not be. You without js or does not do.

Naguglit a simple script send in AJAX (it is desirable on pure JS, without jQuery, to better understand what you are doing) put it in and send as I have written.

It is still interesting. But as you have animation on the button without js works? - Nathaniel79 commented on July 9th 19 at 10:34
: rewrite Ajax: just the button to hang lisener, use e.preventDeafult() describe its animation, and after the timeout already send Ajax post request.
Do time-outs this last century, to get used to colbecki and promises - antonetta.Collins commented on July 9th 19 at 10:37
: animation ripple effect on pure css - Carey commented on July 9th 19 at 10:40

Find more questions by tags HTML