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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:36:17+00:00 2026-05-12T17:36:17+00:00

I just ran into something weird. I have two JSON arrays which holds different

  • 0

I just ran into something weird. I have two JSON arrays which holds different data. Usually I just need data from one of them, but when I try to do a dual ajax call to get data from both arrays, I end up with the exact same data on both calls.

Say array 1 holds JSON data on users, and array 2 holds JSON data on houses, and I want to get data from both arrays: (PS! I cut out the url and type to save a couple of lines.)

$.ajax({
   async:false,
   data:"type=users&id=3,5,6",
   success: function(data) {
      data = JSON.parse(data);
      alert(data.length) //will alert 3 as expected
   }
});

Then I make the second call to get some houses in there as well:

$.ajax({
   async:false,
   data:"type=houses&id=2,4",
   success: function(data) {
      data = JSON.parse(data);
      alert(data.length) //alerts 3 as well...
   }
});

When I look at the params and response with Firebug, I can see that the params are correct, but the response is wrong.

In my PHP I even tried to just echo out whatever comes in doing this:

echo $_GET['id'] . ", " . $_GET['type'];

Which made the request look the exact same on both calls… If I put an alert inbetween the ajax calls, I get the expected result (since the system waits). But I thought putting them both to be synchronous would be enough to not crash up the calls..?

edit: I’ve tried creating a copy of the php file which is called within the AJAX function, and setting the calls to go to seperate files, which makes everything work as expected. So I’m fairly sure there’s nothing wrong with the javascript.

more edit: If I remove the parameters from the second AJAX call, I still get the same result. Looking at the request with Firebug I can see that the params list is empty, but the response is still identical…

even more edit: Looking around in Firebug, I can see there is a header called connection which has the value of keep-alive, and then a header called Keep-Alive with the value of 300. I’m guessing this might have something to do with it? Can’t find anything on it in the jQuery docs, though…

source code: I’ve made a small test case, which reproduces the problem:

PHP

echo $_GET['test'];
die();

HTML

<sript>
    $(document).ready(function() {
      $.ajax({
        type:"get",
        url:"bugtest.php",
        data="test=hello",
        success: function(data) {
          $("output").append(data);
        }
      });
      $.ajax({
        type:"get",
        url:"bugtest.php",
        data="test=world!",
        success: function(data) {
          $("output").append(" "+data);
        }
      });
    });
  </script>
  <h1>AJAX bug in Aptana's PHP server?</h1>
  <output></output>

That’s all I have, and it does the same thing: Instead of getting hello world! like I’d expect, I get hello hello…

  • 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-12T17:36:17+00:00Added an answer on May 12, 2026 at 5:36 pm

    In order to determine wether PHP or JS is the problem you could use Charles to monitor your request (i trust charles more than firebug actually, dunno why) and generate a unique value serverside

    <?php echo uniqid();
    

    If both requests return the same value there is something wrong with your server, else it’s the browser or jscode.

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

Sidebar

Related Questions

I ran into an issue with something that I am probably just overlooking. I
I just ran into the user-defined conversions to or from an interface are not
I just ran into an issue with Python's imaplib and Gmail's authentication mechanism: >>>
Ok, so I just ran into the following problem that raised an eyebrow. For
My development machine is a quad core system, but I just ran into (
I've just started with opengl but I ran into some strange behaviour. Below I
I just ran a PROCEDURE ANALYSE ( ) on one of my tables. And
I just ran across the following error: (.gnu.linkonce.[stuff]): undefined reference to [method] [object file]:(.gnu.linkonce.[stuff]):
I just ran across this error message while working in C# A property or
I made a test file, and ran through the excel file just fine, but

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.