lundi 1 décembre 2014

Parsing a JSON array with jQuery?


JSON newbie here. I have a JSON array that looks like this:



{"d":["asdfad","qweeqe","bvnvbn","lklklklk","dklweppp"]}


How do I parse this in jQuery? I've tried this code:



success: function (r) {
console.log(r);
var stringified = JSON.stringify(r);
var result = '';
$.each(stringified, function (i, val) {
result += val;
});
$('#results').html(result);
}


And I can't get it to display anything once I get the results. Yeah, I know it's a string - I just wanted to see it's output. Using $.parseJSON(r) in place of JSON.stringify(r) returns nothing, not even in the console.


I just want to display them, item by item. What am I doing wrong?


Thanks!





Aucun commentaire:

Enregistrer un commentaire