1.

Write a example for jquery.grep method run on json array

Answer» WRITE a example for jquery.grep method RUN on JSON array
Below is the example for jquery.grep method which APPLY filter on the json array

var dataarray = {
"itemval": [{
"id": 1,
"category": "option1"
}, {
"id": 2,
"category": "option2"
}, {
"id": 3,
"category": "option1"
}]
};

var returnedvalue = $.grep(dataarray.itemval, function (element, index) {
return element.id == 1;
});
alert(returnedvalue[0].id + " " + returnedvalue[0].category);


Discussion

No Comment Found