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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:39:18+00:00 2026-06-01T14:39:18+00:00

So I have a form that the user fills out, when submitted an new

  • 0

So I have a form that the user fills out, when submitted an new tab opens to load the results – the script iterates through multiple XML files – this can be a time consuming process since a lot is happening in that script (2-10 minutes). I wanted some AJAX that would track the progress of the results page so what I did was I had the results page update the user’s session (You may just want to skip to the bottom for my question) Example:

$_SESSION['fileCount'] = $fileCount;
for($i=0;$i<fileCount;$i++){//iterate through xmls
    $_SESSION['curFile'] = $xml[...];
    $_SESSION['curCount'] = $i;
    //Do stuff
}

The form tag on the parent page looks like:

<form action="results/" method="post" onsubmit="openProgressDialog()" target="_blank">

the function above looks like:

    function openProgressDialog(user){
        $('#loadSplash').dialog('open');
        var loading = true;
        var sleep = 50;
        var precent = 0;
        var fileCount = 0;
        var i = 0;
        var curFile = '';
        while(loading){
            $.getJSON('php/getProgress.php?u='+user, function(data) {
                var items = [];
                $.each(data, function(key, val) {
                    if(key == 'fileCount')
                        fileCount = val;
                    else if(key == 'curCount')
                        i = val;
                    else if(key == 'curFile')
                        curFile = val;
                });
                if(fileCount > 0){
                    //Do stuff
                    $('#pregressbar').progressbar('value',(i/fileCount)*100);
                    if(i == fileCount){
                        sleep = 0;
                        loading = false;
                    }
                }
            }).delay(sleep);
        }
    }

And finally the the getProgress.php looks like:

<?php
session_start();
$progress =array('fileCount' =>intval($_SESSION['fileCount']),'curCount' =>intval($_SESSION['curCount']),'curFile'=>$_SESSION['curFile']);
echo json_encode($progress);
?>

So I know I just used an odd combo of pseudo and real code and I’m also aware that the JS function is incomplete – I’ve been monitoring the NET panel in firebug to verify functionality.

So my issue is that the getProgress.php doesn’t return until the results/index.php page completes – which complete defeats the purpose of all this. Is there something about multiple php scripts executing or using the same resources simultaneously that is my hold up here?

I’m running a new version of apache/php on LAMP/Ubuntu.

As a side note/question I’m particularly interested by this topics because I’m planning a multiplayer game that uses AJAX/php/mySQL/long polling and I’m curious if there is anything I should be aware of venturing into that project.

  • 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-01T14:39:19+00:00Added an answer on June 1, 2026 at 2:39 pm

    I’ve asked a similar question once, Show progress for long running PHP script.

    The point is, sessions cannot co-exist. You can’t open the same session on 2 scripts simultaneously, one would trigger an error.

    What you should do is write the status to a database table, and read from that in your AJAX call. Another option would be to use APC Cache.

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

Sidebar

Related Questions

I have a form for that a user fills out and submits. Once submitted
I have a form that I'm submitting with AJAX. A user fills out the
I have a form that a user fills out, which submits information to my
I have a form that the user fills out the company information. I then
I have a form that a user fills out prior to reaching the PayPal
I have a fairly long HTML form that the user fills out. After filling
I have a form that the user fills out which contains a title and
Here's what I want to do. I have a form that the user fills
I have a form that and after the user fills in this form, I
I have a form that a user would fill out while creating a ticket

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.