title: How to get all json values in an ajax success?
body: <p>I have an example json result:</p>
  
  <pre><code>{"Products": [{"ProductIndex": "1", "ProductCode": "116001", "ProductPrice": "$517.00"},{"ProductIndex": "2", "ProductCode": "37732", "ProductPrice": "$288.00"}],"Totals": [{"CartTotal": "$805.00", "Quantity": "2", "DiscountTotal": "0", "LastProduct": "0"}]}
  </code></pre>
  
  <p>I have this jQuery:</p>
  
  <pre><code>     jQuery(function(){
          jQuery.ajax({
             url: '/AjaxCart.asp',
             cache: false,
             dataType: 'text',
             success: function(data) {
                var json = eval('(' + data + ')');
                var quantity;
                var cartTotal;
                var screenId;
                quantity = json.Totals[0].Quantity;
                cartTotal = json.Totals[0].CartTotal;
                screenId = json.Products[0].ProductCode;
                $("#content_area").prepend(screenId);
                },
             error: function() {
                return false;
             }
          });
       });
  </code></pre>
  
  <p>It works, but screenid is only pulling the first value of ProductCode. I need it to loop through the entire result and display both ProductCode values. I've tried putting the .each function around different things but with no results. Any help?</p>
  
  <p>I think I am close with this but it's still not working:</p>
  
  <pre><code>pIndex = json.Products[0];
  for(var i = pIndex.length; i--;) {
  screenItem = pIndex[i];
  $("#content_area.").prepend(screenItem.ProductCode)
  </code></pre>