snnlankrdsm
snnlankrdsm

Reputation: 1401

Getting json datas - jquery

i cannot get the json datas via

     jQuery.parseJSON(myArr);
              $.each(myArr, function(key, value) { 
  alert(key + ': ' + value); 
});

What's wrong ?

Upvotes: 0

Views: 29

Answers (1)

gcochard
gcochard

Reputation: 11744

You need to capture the return of the parseJSON method.

jQuery.parseJSON(myArr);

should read

myArr = jQuery.parseJSON(myArr);

otherwise, you are passing a string into the $.each method.

Upvotes: 2

Related Questions