Let's say I have this function in jquery. I'm trying to acces the id of a specified element and then use as I please.
    var values = somejson.json; 
    $('.get-id').on('click', function () {
        var el = $(this);
        console.log(el.data('id'));
        console.log("====");
        var id = el.data('id'); //get this id
    });
    //i would like to use the id here I retrieve here.
    var result = values.find(x => x.id === id);
    console.log(result);
I think it might be pretty simple but i can't wrap my mind around it. Some help would be highly appreciated. Thanks in advance.
 
     
    