I have to add click event to the dynamic list view. When I click this list it redirect to more detail page. I am fetching the list of Hotels available in particular area and insert into list-view. Now when I click any particular list Hotels redirect to more detail page.
check the following image list view of list of hotels available. Every hotel have unique id So when I click any list it will use that unique hotel id and fetch more details information of that hotel from server and show on one dedicated page for that particular Hotel. My Question is How I add click even on dynamic list view and pass that unique Hotel Id so that later I am able to fetch more information from server using that Hotel Id.
My script code, How to add click even in dynamic list
<script>
$(document).ready(function(){
$("#btnReg").click(function(){
$("#listHotelsOptions").empty();
var distance = document.getElementById('distance_id').value;
var output="";
var hiddenId="";
$.ajax({
url:"http://192.168.1.4/Experiements/webservices/getHotels.php",
type:"GET",
dataType:"json",
data:{type:"login", Distance:distance},
ContentType:"application/json",
success: function(response){
console.log(response)
$.each(response, function(index,value){
hiddenId+='<li type="hidden">'+value.Hotel.Id+'</li>';
output+='<li ><a href="#" style="text-decoration:none;"> <img alt="chef" src="./images/chef.min.png" width="20px" height="20px" >'+value.Hotel.Name+' has'+value.Hotel.Romms+'</a></li>';
});
$("#listHotelsOption").append(output).listview().listview('refresh');
},
error: function(err){
alert(JSON.stringify(err));
}
}) //ajax
}); //click
}); //ready
</script>