I am working on asp.net mvc. I have a json response like,
[{"firstname":"xxx","lastname":"yyy","name":"zzz"},
{"firstname":"aaa","lastname":"bbb","name":"ccc"},
{"firstname":"zzz","lastname":"eee","name":"ddd"},
...]
Now i want to filter the above json response by name that startwith search criteria. I havebeen followed the following way,
var array=[];
array = jQuery.grep(jsondata, function (n,i) { return n.name.startsWith(searchstring); });
but i always get empty array. please guide me.