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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:33:50+00:00 2026-05-14T01:33:50+00:00

I have a PHP process that takes a long time to run. I don’t

  • 0

I have a PHP process that takes a long time to run. I don’t want the AJAX process that calls it to wait for it to finish. When the PHP process finishes it will set a field in a database. There should be some kind of AJAX polling call to check on the database field periodically and set a message.

How do I set up a jQuery AJAX call to poll rather than wait? Does the PHP script have to do anything special?

  • 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-14T01:33:51+00:00Added an answer on May 14, 2026 at 1:33 am

    It’s easier to have your server-side action, simply respond with a negative response until the value is ready and set up the client-side to repeatedly poll (with setTimeout()) until a positive response is received or a fixed number of failures is observed.

     var timer;
     var count = 0;
     function poll(url) {
          timer = setTimeout(function() {
              $.ajax({
                  url: url,
                  success: function(data) {
                      if (data.Status) {
                          ...do something...
                      }
                      else {
                         if (++count > 10) {
                           ...failure action...
                         }
                         else {
                             poll(url);
                         }
                      }
                  ...other options...
               })
          },5000)
     }
    

    Then on the server side use something that does (pseudocode) …

     if operation is not complete
         return serialize( { Status : false } )
     else
         data = ....
         data.Status = true
         return serialize(data)
     end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web script that takes a really long time to run (and
I have a PHP script running that's taking hours, it usually takes a long
Situation: I have many gzipped input files that I want to process in a
I have a simple reporting script that takes 5-10 minutes to run. It's triggered
Possible Duplicate: Show progress for PHP long script I have a PHP script that
Say I want to have a simple web app that takes some user input,
i have one php file which process adding of record in Database fro array.
I have a PHP script where I create a new process using proc_open().It executes
I have an HTML form: <form action='process.php' method='post'> <input type='checkbox' name='check_box_1' /> Check me!<br>
I am creating an insert process in php but I have a problem 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.