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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:31:20+00:00 2026-05-28T05:31:20+00:00

I wonder if we can do something like var joinedJSON; $.get(server.json?action=type&type=image, function(json) {joinedJSON +=json

  • 0

I wonder if we can do something like

 var joinedJSON;
 $.get("server.json?action=type&type=image", function(json) {joinedJSON +=json ; }
 $.get("server.json?action=type&type=jpg", function(json) {joinedJSON +=json ; }
 $.get("server.json?action=type&type=png", function(json) {joinedJSON +=json ; }
 $.get("server.json?action=type&type=tiff", function(json) {joinedJSON +=json ; }

while each request will provide us with say such JSON data:

[
    {
        "href": "bf051e8675b11c72eec781e855593589a086d2295378b96a8b7269c31b8fa673.user.file",
        "title": "Привет Мир.jpg",
        "user_name": "Oleg.Jakushkin@gmail.com",
        "modified": "2012-01-16 07:24:11",
        "is_public": 0,
        "size": 65516
    },
    {
        "href": "abd01be9a0830579d6366e48fc0c48d4c7cc350d80719843ca84c782346626f6.user.file",
        "title": "",
        "user_name": "Oleg.Jakushkin@gmail.com",
        "modified": "2012-01-16 07:24:19",
        "is_public": 0,
        "size": 89782
    },
    {
        "href": "0a27fd3b563b2877c3a072648e0f7c2a57539f3aba4ce688c7774eca6b70774e.user.file",
        "title": "Привет Мир 2.jpg",
        "user_name": "Oleg.Jakushkin@gmail.com",
        "modified": "2012-01-16 07:24:29",
        "is_public": 1,
        "size": 58574
    }
]

Will we get one long array having in mind that some items may repeat (multymap in C++) as result?

  • 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-28T05:31:20+00:00Added an answer on May 28, 2026 at 5:31 am

    Note that the add operation + on Arrays are not defined in Javascript. Instead of extending an array by another one, it coerces them into strings and concatenated.

    [1,2,3] + [4,5,6] // will produce '1,2,34,5,6'
    

    You should use concat instead

    [1,2,3].concat([4,5,6])
    

    Also, note that $.get is an asynchronous function. If you simply serialize them in the code you provided, you will not know when all the requests are finished. Instead, you should try to issue each request in the callback function of the previous one. This ensures that each request is made after the the response from the previous one is received.

    var joinedJSON = [];
    $.get("server.json?action=type&type=image", function(json) {
      joinedJSON.concat(json);
      $.get("server.json?action=type&type=jpg", function(json) {
        joinedJSON.cancat(json);
      }
    }
    

    If you find the nested callbacks ugly, you may consider using the async module.

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

Sidebar

Related Questions

I wonder if I can do something like IBOutlet NSButton * aButton[100]; It turns
I have something like this $.ajaxSetup({ cache: false }); I am wonder can you
I'd like to start coding for NVIDIA 3D Vision and wonder where can I
I wonder if I can create a RelayCommand on my ViewModel like this: public
as a skilled AS3 developer I wonder if there is something like AS3 to
can I have something like this: ¤list 1 element 1 ¤¤list 2 element 1
I wonder how can I export a Visual Studio C++ project to Qt? I
I am going to develop ICQ client and I just wonder where can I
Out of curiosity, I wonder what can people do with parsers, how they are
Wonder if anyone can help me understand how to sum up the column of

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.