Joining Objects from TW Arrays into one Array?
Hey guys,
I am using getJSON in a for loop to collect data. Each response contains an array with multiple objects.
- for (var i = 0; i < index.length; i++)
- {
- $.getJSON("url" + index[i] + "/lists", function (data){
- console.log(data);
- });
- }
the console log will then look something like
- > [Object, Object]
- > [Object, Object, Object]
Now i want to join these two Arrays into ONE new Array...
- > [Object, Object, Object, Object, Object]
I tried to declare a new Array and used .push inside $.getJSON but this doesn't seem to work because it will store Two Arrays containing 2 and 3 Objects..
What am I doing wrong?
Thank you very much