Retrieve array data from JQuery Ajax function into javascript
<p>I'm trying to store data that I am retrieving from my JSON Ajax function. When I console output the data from inside the ajax function it works fine but when I try to do the same with the data variable it is failing.</p>

<p>Am I not storing the resulting data correctly?</p>

<pre><code>function f_find() {

   // create my data object from the results

   var result = $.ajax({
      url      : '../scripts/php/users/f_users.php',
      type     : 'GET',
      dataType : "json",
      data     : {'action':'find'},
      success  : function(data) {

                    // this bit works

                    console.log(data[0]["field01"]);
                    console.log(data[1]["field01"]);

                 },
      error    : function(log) {
                    console.log(log.message);
                 }
   });

   // this shows me that my result is an object

   console.log(result);

   // this bit fails

   console.log(result[0]["field01"]);
   console.log(result[1]["field01"]);

}
</code></pre>

<p>The php is as follows</p>

<pre><code>&lt;?php

if(isset($_GET['action'])) {

   switch($_GET['action']) {

      case 'find':
         f_find();
         break;

      default:
         echo json_encode();
         return;
         break;

   }

}

function f_find() {

   $la_info = array();

   $la_info[0]["field01"] = "index 0 field 1";
   $la_info[0]["field02"] = "index 0 field 2";

   $la_info[1]["field01"] = "index 1 field 1";
   $la_info[1]["field02"] = "index 1 field 1";

   echo json_encode($la_info);

}

?&gt;
</code></pre>