<style>
.CitiesAutocomplete {
list-style: none;
background: #fbfbfb;
border: 1px solid #5f5f5f !important;
width: 350px !important;
position: absolute;
z-index: 10000;
border-top: none;
min-height: 25px;
max-height: 250px;
overflow: auto;
cursor: pointer;
padding: 4px 0;
}
.CitiesAutocomplete li {
padding: 2px 6px;
}
.CitiesAutocomplete li:hover {
/*background-color: #9eeffe;*/
}
.ui-helper-hidden-accessible {
display: none;
}
.alert:empty {
display: none;
}
.centered {
display: none;
position: fixed;
top: 50%;
left: 50%;
margin: -100px 0 0 -150px;
z-index: 10000;
}
.tooltip {
text-align: center;
}
.row {
display: flex; /* equal height of the children */
}
.column {
flex: 1; /* additionally, equal width */
padding: 1em;
}
</style>
function LoadDropAddress() {
$('.drop-address').autocomplete({
source: function (request, response) {
$.ajax({
url: "@Url.Action("GetBusinessForPickup", "Partner")",
data: { SearchText: request.term },
dataType: "json",
type: "GET",
success: function (data) {
if (data.length == 0) {
return false;
}
else {
response($.map(data, function (item) {
return {
label: item.description,
value: item.place_id
}
}));
}
},
error: function (x, y, z) {
alert('error');
}
});
},
select: function (event, ui) {
$(this).val(ui.item.label);
var selectedrow = $(this).closest("tr");
GetVenueDetailsByPlaceId(ui.item.value, '', selectedrow);
return false;
},
focus: function (event, ui) {
$(this).val(ui.item.label);
return false;
}
}).autocomplete("widget").addClass("CitiesAutocomplete");
}
$("#addAnother").click(function () {
var $table = $("#drop-detail"), $tr = $table.find('.drop-detail-row');
$.get('@Url.Action("AddDropDetails", "Delivery")', function (template) {
$("#drop-detail").append(template);
LoadDropAddress();
});