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 9272655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:55:31+00:00 2026-06-18T15:55:31+00:00

I have a JavaScript snippet in my page which contains ajax function in that

  • 0

I have a JavaScript snippet in my page which contains ajax function in that to get the data from the database queries, The code is as follows:

$('#fpgo2').click(function () {
  var sanswer = $('#sanswer').val();
       if (sanswer != "") {                                                                                     
                    $.ajax({
                    type: 'POST',
                url: root_url + '/services/services.php?method=forgotpassword',
                    data: {email:email,sanswer:sanswer},
                    async: true,
                   success: function (data) {
                    //alert(data);
                    if (data == 1) {
                                 ************
                                 ************     
                          } else if (data == 2) {
                    $('#msg_noseqqstn').html('Wrong answer').show();
                     } else {
                      alert('**********');       
                      }
                      }
                      });
                       }
                      else{
                          ***********
                          }
                          });

Here i want to calculate how many times the below code gets executed in a period of 24hrs

else if (data == 2) {
                        $('#msg_noseqqstn').html('Wrong answer').show();
                         }

and the condition is if I get this response for 5 times in a span of 24hrs, i’ll need to do perform another function. So, can anyone let me know how can i know the number of times the error “Wrong Answer” code executed and also how to set the time period i.e, 24hrs period for the user. Thanks in advance.

  • 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-06-18T15:55:32+00:00Added an answer on June 18, 2026 at 3:55 pm

    This is a good candidate for a database. You could have a table with 3 fields : IPAddress, Attemps, LastDate so that for each IP address you know how many attemps have been made for the current last date.

    Whenever the actual date is not the same anymore, the attempt count is reseted to 1. Here is a pseudocode for what the mechanic could look like:

    if (same date) {
        if (attemps < 5) {
            if (!try_connect()) {
                attemps++;
            }
        } else {
            error();
        }
    } else { // different date
        attemps = 1;
    }
    
    lastDate = actualDate;
    

    Hope this helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this javascript snippet which passes an id and the reffering page to
I have JavaScript code which copies the value of input file and paste it
If I have a page which contains an iframe: <iframe src=blank.html id=frame></iframe> and I
I have the following jQuery snippet which should replace a code such as [Button]
I have a script tag which calls a remote JavaScript snippet through src, and
I have a javascript function I'm writing which is being used to include an
I have a script embedded in a page, which is as follows: <script type=text/javascript>
I have the following Javascript snippet that receives an customerID via parameter (i'm going
I have some JavaScript code that dynamically injects an iframe in a given HTML
I have a web page with the following code snippet: ... <td nowrap=true valign=top

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.