title: List JSON array
body: <p>I have a php (history.php) that creates a json</p>
  
  <pre><code>$i=1;
   $q=mysql_query("select * from participants where phone='".mysql_real_escape_string($_GET['phone'])."' limit 10");
   while($rs=mysql_fetch_array($q)){
        $response[$i] = $rs['code'];
  $i++;   
      }
      print json_encode($response);
      exit;
  </code></pre>
  
  <p>In js I access this file:</p>
  
  <pre><code>var req=$.get("history.php", { phone: "" + phone + ""},
  
                          function(data) {
          //data="1":"code1","2":"code2","3":"code3","4":"code4","5":"code5"};
                              var msg = "";
                              for(i=1;i&lt;=5;i++){
                                  msg+= "&lt;li&gt;"+data[i];
                              }
                              $(form_message).html(msg);
  
                          })
  </code></pre>
  
  <p>After this code is executed my output is</p>
  
  <p><em><li>"</li><li>1</li><li>"</li><li>:</li><li>"</li></em></p>
  
  <p>which means that 'data' is not passed as an array.. it's passed like a string.
  But if I uncomment the data var in js everything is ok.
  The output is:</p>
  
  <p><em><li>code1</li><li>code2</li><li>code3</li><li>code4</li><li>code5</li></em></p>
  
  <p>Can you please tell me what am I doing wrong when passing the data from php. </p>
  
  <p>Thanks in advance</p>