Your question is very difficult to follow, but working on the presumption that you need to get the value from the clicked button within a single function, this may help.
$( "ul li" ).click(function() {
value = $(this).data("value");
alert( value );
});
solved Get the item ref number on click of button in li of ul?