I have data with json format, and I tried to show her with ajax and successfully. but how to find one id in json using ajax? and whether the script I got it right? example I want to find id 2.
My json
{ "device": [
    {
        "id": 1,
        "name": "Android"
    },
    {
        "id": 2,
        "name": "Apel"
    },
    {
        "id": 3,
        "name": "Windows"
    }
] }
My ajax
$(document).ready(function() {
    var id_pm = 2 ;
    var dataString = "id="+id_pm;   
    $.ajax({
        type: "GET",
        url: "data.json",
        data: dataString,
        cache: false,
        timeout: 3000,
        error: function(){
            alert('Error');
        },              
        success: function(result){
            var result=$.parseJSON(result);
            $.each(result, function(i, element){        
                var id=element.id;
                var name=element.name;  
            }); 
        }
    });
}); 
 
     
    