title: Accessing data in a multidimensional JSON array with jQuery
body: <p>I am trying to work out how to access data in an essentially multidimensional JSON array. </p>
  
  <p>My jQuery AJAX request looks like this:</p>
  
  <pre><code> $("#login-form").submit(function(e) {
   e.preventDefault();
   $.ajax({
     type: 'POST',
     url: '/ajax/login',
     data: 'email='+$("#email").val()+'&amp;password='+$("#password").val(),
     success: function(data){
  
       // FIRE ALERT HERE        
       alert(data.firstname);
  
       },
       dataType: 'json'
    });
  });
  </code></pre>
  
  <p>This is what i am getting back. User account details, plus a list of products they have against their account.</p>
  
  <pre><code>{
      "logged_in":true,
      "firstname":"Joe",
      "surname":"Bloggs",
      "Full_name":"Joe Bloggs",
      "email":"email@website.com",
      "phone":"+123456789",
      "website":"",
      "age":"26-35",
      "street":"1 Street Ave",
      "city":"Townland",
      "state":"NA",
      "postcode":"1234",
      "country":"Australia",
      "products":2,
      "0":{
          "product_no":"1087",
          "customer":"2",
          "bought_from":"1",
          "date_of_purchase":"2011-04-08",
          "method":"instore",
          "invoice":"0",
          "current":"1"
      },
      "1":{
          "product_no":"24",
          "customer":"2",
          "bought_from":"1",
          "date_of_purchase":"2011-04-08",
          "method":"instore",
          "invoice":"0",
          "current":"1"
      }
  }
  </code></pre>
  
  <p>As you can see, i am alerting the first name, which is fine. I can access everything in the first dimension by using data.key but i'm not sure how then i need to index the next dimension. Obviously I would like to display each of the products somehow.</p>
  
  <p>Suggestions would be most welcome.</p>