title: Getting Response From Jquery JSON
body: <p>I'm having trouble getting a response from my php jquery / json / ajax. I keep combining all these different tutorials together but I still can't seem to pull it all together since no one tutorial follow what I'm trying to do.</p>
  
  <p>Right now I'm trying to pass two arrays (since there's no easy way to pass associative arrays) to my jquery ajax function and just alert it out. Here's my code:</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>$names = array('john doe', 'jane doe');
  $ids = array('123', '223');
  
  $data['names'] = $names;
  $data['ids'] = $ids;
  
  echo json_encode($data);
  </code></pre>
  
  <p><strong>Jquery</strong></p>
  
  <pre><code>function getList(){
      $.ajax({  
          type: "GET", 
          url: 'test.php', 
          data: "",  
          complete: function(data){ 
              var test = jQuery.parseJSON(data);
              alert(test.names[0]);
              alert("here");
          }
      },
          "json");
  }
  getList();
  </code></pre>
  
  <p>In my html file all I'm really calling is my javascript file for debugging purposes. I know i'm returning an object but I'm getting an error with null values in my names section, and i'm not sure why. What am I missing?</p>
  
  <p>My PHP file returns</p>
  
  <pre><code>{"names":["john doe","jane doe"],"ids":["123","223"]}
  </code></pre>
  
  <p>It seems to be just ending here 
  <code>Uncaught TypeError: Cannot read property '0' of undefined</code> 
  so my sub0 is killing me.</p>