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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:54:53+00:00 2026-05-26T10:54:53+00:00

I have an embedded XMLHttpRequest problem; The flow of data should go like this:

  • 0

I have an embedded XMLHttpRequest problem;

The flow of data should go like this:

Interface.php uses modifyRecords.js (XMLHttpRequest) to call information from modifyRecords.php, which in turn uses showRecords.js (XMLHttpRequest) to call information from showRecords.php.

If I could somehow accomplish this, it would save a ton of code copying and/or rewriting.

When I backtrack to find where the errors are, there doesn’t appear to be any problem showRecords.php and modifyRecords.php both load fine individually, just when AJAX calls another AJAX it totally breaks.

The nitty gritty is this:

My user interface is calling modifyRecords.js which is as follows;

function modifyRecords(cell,report,column,oldValue)
{

    if (window.XMLHttpRequest)
      {// code for IE7+, Firefox, Chrome, Opera, Safari
     var xmlhttp=new XMLHttpRequest();
      }
    else
      {// code for IE6, IE5
     var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    xmlhttp.onreadystatechange=function()
      {
      if (xmlhttp.readyState==4 && xmlhttp.status==200)
        {
        document.getElementById(cell).innerHTML=xmlhttp.responseText;

        }
      }
    xmlhttp.open("GET","modifyRecords.php?report="+report+"&column="+column+"&oldValue="+oldValue,true);
    xmlhttp.send();

}

modifyRecords.php is calling another AJAX function called showRecords.js;

function showRecords(str,column,nextDiv,oldValue)
{
if (str== null)
  {

  document.getElementById(nextDiv).innerHTML="----------------------------------------";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
 var xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
 var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById(nextDiv).innerHTML=xmlhttp.responseText;
    document.getElementById(nextDiv).value = oldValue ;


    }
  }
xmlhttp.open("GET","showRecords.php?"+column+"="+str,true);
xmlhttp.send();

}

The problem is that each one of these works in isolation, however, when I use one AJAX function to call a page that is dependent on the second AJAX function, the records do not load.

I know this has something to do with synchronicity, because my only guess is that the referenced page has not finished loading when the referencing function is calling it.

I have tried setting the parameters to “false” for synchronous, instead of the usual asynchronous, however that breaks either function.

What would be the best solution?

I have considered combining all my AJAX functions, which would require a ton of rewrite to make them more generic, and functional for both environments.

  • 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-26T10:54:54+00:00Added an answer on May 26, 2026 at 10:54 am

    Unless I’m much mistaken, you are trying to call your second AJAX script by setting the innerHTML of an element with the first?

    Scripts aren’t executed when added with innerHTML. Don’t know why, it’s been an annoyance to me, but you’d probably be better off separating HTML and JS, then putting the HTML in the innerHTML, and eval‘ing the JS.

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

Sidebar

Related Questions

I have an embedded flash that is transparent so it looks like part of
I have embedded derby database and i work with jpa. This is my persistence.xml:
I have embedded some crystal reports in my C# application. The problem is, compiling
I have embedded fb's social like plugins into my blog . it will state
Dynamic libraries are nice. The have embedded information in them that help the runtime
I have embedded the fullcalendar jquery control by using this code: $(document).ready(function() { var
I am using the Ajax Minifier http://www.ajaxprojects.com/ajax/tutorialdetails.php?itemid=766 and have embedded it in the csproj
I want to have a dynamic webpage that automaticly updates some information, this information
I have embedded an online-call on a website. You can see it here right
I have embedded a flash video on my website. I am having the problem

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.