i have a json data .
data ={{"id":"10","name":"test"},{"id":"10","name":"test1"},{"id":"11","name":"tsst"},{"id":"41","name":"jhkj"},{"id":"11","name":"yuyyu"},}
from the json data i am fetching the id to get location from a database table as follows
data.each(function( index ) {
var id = index.id //gets 10
//again gets 10 and again doing db operations for same id value
//db operations
//get location details from db using this id
// operations after getting locations....................
});
my proble is id is repeated ie 10,10,11,41 ,11.so calling db operations for repeated values also.How can i avoid by calling db operations for repeated id values .