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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:05:30+00:00 2026-06-04T00:05:30+00:00

I am developing functionality similar to an auction, using jQuery, AJAX, PHP and mySQL.

  • 0

I am developing functionality similar to an auction, using jQuery, AJAX, PHP and mySQL.

Ajax accesses the server every second to get the most recent bid, and during this call we also get the remaining time from the server to keep all participants in sync.

I have two issues:

1) Occasionally the time remaining flickers back to the value of the previous time for a fraction of a second. Could this is to do with the asynchronous results getting out of sync?

Snippets of the relevant code:

function dotimer() {
    updateScreen();
    setTimeout('dotimer()',1000);
}

function updateScreen(){
    $.ajax({
        type : 'POST',
        url : 'getinfo.php',
        dataType : 'json',
        data: { /* various params are passed to php */ },
        success : function(data){
            /* other info processed here...*/
            $("#countdowntimer").html(data.secondsremaining);           
        },
        error : function(XMLHttpRequest, textStatus, errorThrown) {}
    });
}

getinfo.php:

$return['secondsremaining'] = strtotime($end_time)-strtotime("now");
/* get other infor from database... */
echo json_encode($return);

(setTimeout and setInterval both had the same results.)

2) Is accessing the database every second excessive? I can’t see an alternative to ensure information is up-to-date. Is there a better way to do this?
The auction is for a relatively short period of time (30 min) and we do not expect any more than 10 participants.

Any advice/suggestions welcome, thanks!

  • 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-04T00:05:31+00:00Added an answer on June 4, 2026 at 12:05 am

    I think that’s exactly your problem. As the requests are asynchronous, you cannot control the order that they are executed. You have to synchronize your requests and avoid multiple requests ie you can only do a new request if there aren’t pending requests, else you cannot control when the callback for each request is fired.

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

Sidebar

Related Questions

I am developing an application using C# having similar functionality of copy,paste as in
I am developing a website using asp.net, So far so good. the functionality does
I'm developing a web application, using ASP.net and C# need to provide a functionality
i'm developing an android application similar to Google places app. I want a functionality
I'm developing a grid with excel-like functionality using the telerik controls. For example users
I am developing something that will require similar functionality to the Silverlight DatePicker -
I'm developing own CMS and i want to implement functionality to dynamically include existing
I am developing a component to create bespoke BulkImport functionality in ASP.NET. Underline this
I am developing one application which include the email sending functionality (which is like
I am developing a library. I want some functionality to be additionally available in

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.