title: $.ajax() - working with returned json data
body: <p>I am unable to extract data form the returned json data from ASP.NET webmethod. Here is my code:</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: "myurl",
      data: "{}",
      contentType: "application/json; charset=utf-8",
      dataType: "json",
      success: function (appdata) {
          console.log(appdata.d);
          var testdata = appdata.d;
          //$.each(testdata, function (index, appt) {
          //    console.log(appt);
          //});
      }
  });
  </code></pre>
  
  <p><code>console.log(appdata.d)</code> returned data in following format</p>
  
  <pre><code>[
   {
    'PRODUCTID' : '51',
    'ENTRYDATE' : '2/13/2013 12:00:00 AM',
    'CATEGORYID' : ''
   },
  
   {
    'PRODUCTID' : '52',
    'ENTRYDATE' : '2/13/2013 12:00:00 AM',
    'CATEGORYID' : ''
   }
  ]
  </code></pre>
  
  <p>code </p>
  
  <pre><code>//$.each(testdata, function (index, appt) {
  //    console.log(appt);
  //});
  </code></pre>
  
  <p>resulted in following error:</p>
  
  <pre><code>Uncaught TypeError: Cannot use 'in' operator to search for...
  </code></pre>
  
  <p>How can I extract this data??</p>
  
  <p><strong>Edit</strong>
  <code>console.log(appdata)</code> gives the following</p>
  
  <pre><code>Object {d: "[{'PRODUCTID' : '51','ENTRYDATE' : '2/13…ENDTIME' : '2/13/2013 3:45:00 AM','CATEGORYID' : ''}]"}
  </code></pre>