I have json array like this one:
[{"code" : "A1", "desc" : "desc1"},{"code" : "A2", "desc" : "desc2"}]
How should i parse it in jquery to get data like this:
A1 - desc1
A2 - desc2
I tried lots of different ways, but none of them works. At the moment i have a code like this:
$.ajax({
url: 'my_url',
success: function(data) {
$.each(data, function (key, val) {
alert(val.code);
});
},
error: function() {
alert('problem');
}
});
$.parseJSON
ondata
– nhahtdh Oct 11 '12 at 17:05