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

  • Home
  • SEARCH
  • 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 7080971
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T06:51:38+00:00 2026-05-28T06:51:38+00:00

So, i’m working on a progress bar for a CSV processing script. dnc_scrubber.php goes

  • 0

So, i’m working on a progress bar for a CSV processing script. dnc_scrubber.php goes through the CSV and checks a phone number against a database, returning matched and unmatched data in separate files. lines.php returns the total amount of lines to be processed while progress.php returns how many lines have been worked through. I use these two numbers to create a percentage of work done for jQuery’s progressbar function.

My problem is that the first .ajax() call within doProgressBar() doesn’t finish until the call to dnc_scrubber.php is finished. To clarify, when looking at the network monitor in Chrome, the request is made to lines.php at the same time as the request to dnc_scrubber.php, but no response is received until dnc_scrubber.php finished running. Here is the relevant code:

$('#progressbar').progressbar();            


$.ajax({
url: 'dnc_scrubber.php',
type: 'POST',
async: true,
data: querystring,  
success: function(){
    for (i = 0; i < files.length; i++){
        $('#complete').append('<a href="process/MATCHED - ' + files[i] + '">MATCHED - ' + files[i] + '</a><br />');
        $('#complete').append('<a href="process/SCRUBBED - ' + files[i] + '">SCRUBBED - ' + files[i] + '</a><br />');
    }
}                       
});


function doProgressBar(){                   
$.ajax({
    url: 'lines.php',
    async: true,
    dataType: 'json',
    complete: function (rez) {
        lines = JSON.parse(rez.responseText);
        lines = parseInt(lines.lines);

        console.log('dpg1 - lines: ' + lines);

        $.ajax({
            url: 'progress.php',
            async: true,
            dataType: 'json',
            complete: function (rez1) {
                prog = JSON.parse(rez1.responseText);
                prog = parseInt(prog.progress);

                console.log('dpg2 - lines: ' + lines + ' prog: ' + prog);

                if (lines > prog){
                    var bar = (prog / lines) * 100;                                         
                    var bar = Math.round(bar);                                          
                    $('#progressbar').progressbar('option', 'value', bar);
                    setTimeout(doProgressBar(), 1000);
                    console.log('dpg3 - lines: ' + lines + ' prog: ' + prog + ' bar: ' + bar);
                } else if (lines == prog){
                    $('#progressbar').progressbar('option', 'value', 100);
                    console.log('dpg3 - lines == prog');
                }

            }
        });

    }
});
}



setTimeout(doProgressBar(), 100);

Is this normal functionality? Is what I’m trying to do not possible? I’m at a loss… thanks in advance for help

EDIT:
lines.php

session_start();
header('Content-type: application/json');
echo json_encode(array('lines' => $_SESSION['lines']));

progress.php

session_start();
header('Content-type: application/json');
echo json_encode(array('progress' => $_SESSION['lines_processed']));

The CSV processor increments the $_SESSION['lines_proccessed'] by one at the end of the checking process for every line

  • 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-28T06:51:39+00:00Added an answer on May 28, 2026 at 6:51 am

    Most likely, your server limits the number of concurrent connections per user to 1. Or, you are using sessions and the first script has it locked. The second script will be blocked until the first one releases its lock on the session file. Only use session_start() if you need to, and release the lock with session_write_close() as soon as you are done with it.

    Edit: I’m not sure if this will work, but you could try it. Each time you want to update the session, call session_start(), update the session, then call session_write_close(). I’m not sure if you are allowed to do that multiple times in a script, but it seems like it should work.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I am trying to loop through a bunch of documents I have to put

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.