I have codeigniter application which fetches data from database and this data is manipulated by Jquery. Result array from database used to look like this:
{ "result":[
{"name":"John","surname":"Smith"}] }
And I use to parse it using code below:
$.get("index.php/getResult",{f_name: $('#fn').val()} ,function(data) {
var list= "";
$.each(data, function(index, element) {
if (index > 0) {list;}
list+= element.name;
});
$('#myid').html(list);
},"json");
My result array has changed to the format below, how can I parse it now? Any help is appreciated.
{
"count": 8,
"result":[
{"name":"John","surname":"Smith"}] }