-1

I'm trying to write a script that retrieves data from JSON using jquery. I searched the downloaded array. How to find the value to perform any operation. I pull out the data using getJSON and everything works. But I'm having trouble finding the search. Can anyone help me? This data from JSON:

[{"id":"10","data":"12345"},{"id":"11","data":"6666"}]
Barmar
  • 741,623
  • 53
  • 500
  • 612
mitos m
  • 3
  • 1

1 Answers1

0

The simplest way to search through an array would be....

var data = [{"id":"10","data":"12345"},{"id":"11","data":"6666"}];

for(var row in data)
{
    var item = data[row]; //This is the object {id:..., data:...}

    if(item.id == ...) //Use if statement to search for data
    {
       //do something here when data is found
    }
}