Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6475901
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:45:37+00:00 2026-05-25T06:45:37+00:00

I have a form which does an AJAX action when submitting. Just after a

  • 0

I have a form which does an AJAX action when submitting. Just after a user has submitted the form, I’d like to impose a minimal waiting time of 5sec to post one more time.

What the better way ? I made this script (doesn’t work but I guess idea is here):

$("form#submit_under_wall"+array[1]).submit(function() {

    var submit_timestamp=0;
    var c = new Date();
    var now = ISODateString(c); 

    if(now-submit_timestamp>5){

         var d = new Date();
         var timestamp_message = ISODateString(d); 
         submit_timestamp = timestamp_message ;

          //AJAX ACTION             

    }else{ alert("Wait 5sec between each post."); }


return false;   
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:45:37+00:00Added an answer on May 25, 2026 at 6:45 am

    This doesnt work because the timestamp is reset every time they submit, you need to move submit_timestamp outside of the function. Also, that 5 should probably be 5 * 1000

    something like this (not tested):

    var submitTime = (new Date()).getTime() - 5000; //let user submit if he clicks within 5s of page load
    $("form#submit_under_wall"+array[1]).submit(function(e) {
        var now = (new Date()).getTime();
        if(now-submitTime > 5000){
             submitTime = (new Date()).getTime();
             //AJAX ACTION             
        } else {
            alert("Wait 5sec between each post.");
        }
        e.preventDefault(); 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C# windows application which does the following: 1) the main form
I have a form which takes both the user details and an image uploaded
I have a form which has a lot of SELECTs. For various reasons, I'd
I have a form which users must fill out and submit. The controller action
I have a form which has only tab control in it. I want to
I have a form which is a mdicontainer and has a menu strip at
I have a form which, when the button gets clicked by a user, redirects
I have a form, in which I need to send data selected via AJAX
I have a form using jquery validation plugin. My submit button has an ajax
I have a form which on submit should see if the text area has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.