Ok, I found the answer.
It was as simple as doing this: alert(data[0].name);

Notice the [0].

So here is the functional code for anyone who is wondering about this:

javascript file
---------------------------
jQuery(document).ready(function() {

  jQuery('#storeListTable tr').click(function() {

    jQuery.post("get_storeData.php", { storeID: this.cells
[0].innerHTML },     // this.cells[0].innerHTML is the content ofthe
first cell in selected table row
      function(data){
         alert(data[0].name);
      }, "json");
    });

});


php file
---------------------
<?php
  include_once('dal.php');

  $storeID = $_POST['storeID'];   //Get storeID from jQuery.post
parameter

  $sl = new storeLocator();
  $result = $sl->getStoreData($storeID);  //returns dataset from MySQL
(SELECT * from MyTale)

  while ($row = mysql_fetch_array($result))
  {
    $data[] = array(
    "id"=>($row['id']) ,
    "name"=>($row['name']));
  }

  $storeData = json_encode($data);

  echo $storeData;
?>


Thanks for all your help guys!

Reply via email to