title: get value of json returned data
body: <p>Im doing a ajax call to retrieve data. the data is like this:</p>
  
  <pre><code>[{"id":"16","location_name":"agga"}]
  </code></pre>
  
  <p>this is because the php returns: echo <code>json_encode($getLoc);</code></p>
  
  <p>now in the javascript i need to change a input value to the json given ID and show the location name as a string in a div. How can i do this ?</p>
  
  <p>what i tried:</p>
  
  <p>data.id undefined
  data[0].id ..undefined
  data shows <code>[{"id":"16","location_name":"agga"}]</code></p>
  
  <p>then i tought maybe i need to loop so I did a jquery each... but that also returned nothing..</p>
  
  <p>so now I came here,, what im I doing wrong?</p>
  
  <p>code:</p>
  
  <pre><code> $('#deliveryzip').on('change', function(){
  
      //Get zip first 4 chars
      var zip = $('#deliveryzip').val().substring(0,4);
  
          //Check if zip is integer
          if (isNaN(zip)) {
              //alert("zip klopt niet");
              return false;
          }
  
      //Get locationID from zipcode
      $.post(jssitebaseUrl+'/ajaxFile.php',{"zip":zip,"action":"getLocInfo"},function(data){
  
          $("#locInfo2").html(data); //shows the json returned object
          var show = true;
          return false;
      });   
  </code></pre>