Please try the following code inside success function-
$.each(data, function(i,item) {
var $landmark = $('<ul><li /></ul>').text(item.name);
$landmark.bind('click', function(){
$('#target-text-box-id').val($landmark.text());
});
$landmark.appendTo(output1);
});
Alternatively, you can also make use of jQuery
on(). Inside $.each -
Create the li element with some class like -
var $landmark = $('<ul><li class="landmark-item" /></ul>').text(item.name);
and append to ul-output1.
Then write an event handler outside $.ajax() like -
$('.landmark-item').on('click', function(){
$('#target-text-box-id').val($(this).text());
});
Hope this works for you.
Thanks