title: Reading multiple JSon records to an array
body: <p>I'm pretty n00b with JS programming so this is maybe a stupid question, but after hours of searching I haven't find a working solution from the net. </p>
  
  <p>I have multiple JSON feeds. Server is giving one multilayer JSON record per url like this (data is imaginary test data):</p>
  
  <ul>
  <li><p><a href="http://address/ci/c/1" rel="nofollow noreferrer">http://address/ci/c/1</a> gives:</p>
  
  <p><code>{
  "LGICUS01OperationResponse": {
  "ca": {
    "ca_phone_mobile": "07799 123456",
    "ca_request_id": "01ICUS",
    "ca_return_code": 0,
    "ca_dob": "11.07.1950",
    "ca_last_name": "Pandy",
    "ca_num_policies": 0,
    "ca_phone_home": "01962 811234",
    "ca_email_address": "A.Pandy@beebhouse.com",
    "ca_house_name": "",
    "ca_policy_data": "",
    "ca_customer_num": 1,
    "ca_first_name": "Andrew",
    "ca_house_num": "34",
    "ca_postcode": "PI101OO"
  }
  }
  }</code></p></li>
  <li><p><a href="http://address/ci/c/2" rel="nofollow noreferrer">http://address/ci/c/2</a> gives:</p>
  
  <p><code>{
  "LGICUS01OperationResponse": {
  "ca": {
    "ca_phone_mobile": "123",
    "ca_request_id": "01ICUS",
    "ca_return_code": 0,
    "ca_dob": "30.09.1965",
    "ca_last_name": "Tracey",
    "ca_num_policies": 0,
    "ca_phone_home": "",
    "ca_email_address": "REFROOM@TBHOLDINGS.COM",
    "ca_house_name": "Tracey Island",
    "ca_policy_data": "",
    "ca_customer_num": 2,
    "ca_first_name": "Scott",
    "ca_house_num": "",
    "ca_postcode": "TB14TV"
  }
  }
  }</code></p></li>
  </ul>
  
  <p>And so on. Now I have managed to read the JSON recors with ajax, but I have serious problems to pass that array of information outside the getCurrentJson function. Optimal situation would be that the first two parameters will be omitted so that there would be an array of user information for later manipulation in a "standard way" like this:</p>
  
  <pre><code>{
      "rows":[
          {"ca_customer_num":1", "ca_first_name:"Andrew",...}
          {"ca_customer_num":2", "ca_first_name:"Scott",...}
      ...
      ]
  }
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;JSON test&lt;/title&gt;
            &lt;script src="jquery.js" type="text/javascript"&gt;&lt;/script&gt;      
            &lt;script&gt;
            var myjson = [];
            for (i = 1; i &lt; 11; i++) {
                getCurrentJson(i);
                console.log(myjson[i].LGICUS01OperationResponse.ca.ca_phone_mobile);
            }
  
            function getCurrentJson(current){
              $.ajax({ 
                  dataType: "json",
                  url: "http://192.49.208.193:9081/ci/c/"+current,
                  success: function(data){
                      myjson[current] = data;
                      console.log(myjson[current]);
                      console.log(myjson[current].LGICUS01OperationResponse.ca.ca_phone_mobile);
                  }
                });       
            }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now the console.log outputs inside ajax-function prints Object information and the "ca_phone_mobile" number fine, but the first console output in the for loop says: "Uncaught TypeError: Cannot read property 'LGICUS01OperationResponse' of undefined(…)". Do I need some toString datatype conversion or similar? I have also tried to pass the myjson array to the getCurrentJson function but with no success. </p>