title: reading json encoded multiple php arrays using ajax request
body: <p>I have used json_encode to encode two php arrays and now i have to read through ajax. Could anyone please let me know how to read those arrays through ajax request.</p>
  
  <p>For example: i have a php file file1.php which has</p>
  
  <pre><code>echo json_encode($array1);
  echo json_encode($array2);
  </code></pre>
  
  <p>Another file in which i read as follows:</p>
  
  <p>For reading single encoded array i am reading like this</p>
  
  <pre><code>new Ajax.Request("file1.php",
         {
           method:'get',
           asynchronous:false,
           parameters: ({id: stopID, contains: tempContain}),
            onSuccess:function(data){
                  var result=data.responseJSON;
  
                  var keys = Object.keys(result);
                  var values = Object.values(result);
  
                  for(var i = 0; i &lt; keys.length; i++) {
                       infoString += keys[i]+":"+values[i];
                  }               
    });
  </code></pre>