title: Cannot read property of undefined after JSON parse
body: <p>I have done an ajax request in my code and it works good. After that I want to extract only the necessary info and re-post it to another script. Until now here is my code:</p>
  
  <pre><code>$.ajax({
          type: "POST",
                  url: url,
                  data: {xhr_id: xhr_id},
                  success: function (jsondata) {
  
                      var product_data = [];
  
                        for (var i = 0; i &lt;= 3; i++) {
  
                          //alert(jsondata.products[i].product_description.toSource());
  
                          product_data[i] = {};
                          product_data[i]["product" + i] = jsondata.products[i].product_description;
  
                          //alert(product_data[i]["product" + i].toSource());
                      }
                  },
                  dataType: "json"
          });
  </code></pre>
  
  <p>The problem is that both the alerts work fine, displaying the information I want. However, I get an error message of "Uncaught TypeError: Cannot read property 'product_description' of undefined" which breaks the script and prevents me from doing anything else. What am I doing wrong, any ideas?</p>