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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:02:23+00:00 2026-05-26T04:02:23+00:00

I have a table where each row has a button that triggers AJAX call.

  • 0

I have a table where each row has a button that triggers AJAX call. Calling the same function but different parameters. The result is displayed in the same row that the call was made from.

The call does svn up so it can take even a minute or so. I can observe that if I initiate new AJAX call before the previous one finishes I loose the result of the call.

Is there any way I can run multiple AJAX calls at the same time and get the results from the call and display them?

  • using jQuery
  • inside the same browser window
  • calling php

HTML code that calls javascript

    <button type="button" onclick="update_revision(\'' . $directory  . '\',\''.$server_name.'\')" > update </button>

Javascript

   function update_revision(revision,server_name)
    {
      if (window.XMLHttpRequest)
        {// code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp=new XMLHttpRequest();
        }
      else
        {// code for IE6, IE5
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
      xmlhttp.onreadystatechange=function()
        {
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
          {
          document.getElementById("rev."+revision).value="updated to "+update_to;
          }
        }
      xmlhttp.open("GET","https://"+server_name+"/imacs/radek/svn_update.php?code_base="+revision+"&revision="+update_to+"&t=" + Math.random(),true);
      xmlhttp.send();
    }        
  • 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-26T04:02:24+00:00Added an answer on May 26, 2026 at 4:02 am

    The problem is that you’re using a single global variable to store all your XMLHttpRequest instances. Whenever you create a new instance, and store its reference in the global variable, xmlhttp, the instance that was previously referenced there becomes un-referenced, and so it will be garbage collected as soon as the browser sees fit. Usually, this means it is garbage collected immediately; and in your case, it is being garbage collected even before the pending response is received.

    One way to fix this problem, is to declare xmlhttp as a local var within your update_revision() function. Like this:

    function update_revision(revision, server_name) {
        // declare xmlhttp locally
        var xmlhttp;  
    
        if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlhttp = new XMLHttpRequest();
        }
        else { // code for IE6, IE5
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 ) {
                if( xmlhttp.status == 200) {
                    document.getElementById("rev." + revision).value = "updated to " + update_to;
                }
    
                // explicitly drop the reference when
                // we're done with it, so the browser will reclaim the object
                // (this is optional, but it's a good idea)
                xmlhttp = null;
            }
        }
        xmlhttp.open("GET", "https://" + server_name + "/imacs/radek/svn_update.php?code_base=" + revision + "&revision=" + update_to + "&t=" + Math.random(), true);
        xmlhttp.send();
    }
    

    NOTES:

    1. xmlhttp is declared as a local var

    2. xmlhttp is “nulled” when we don’t need it anymore (after readyState == 4). This will cause the browser to garbage collect the request instance, thus preventing resource leaking. This is a good practice (and so I’ve shown it in the example above), but technically, it’s optional.

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

Sidebar

Related Questions

I have a table with multiple rows. Each row has a check button. How
I have a table that has Edit and Delete links in each row. I
I have a table where each row has 13 TD elements. I want to
I have a table column where each row has one of three states, and
I have a DB table in which each row has a randomly generated primary
I have a table style page with rows. Each row has a checkbox. I
I have a table where each row has a start and stop date-time. These
I have a table (Dataview) with content from a database, where each row/object has
I have a button that will create a new entry (row in a table)
I have multiple table rows that has a set of radio buttons on each

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.