$( "#location" ).autocomplete({
source: 'property-location/?city=' + $('[name=city]').val() + $(this).val()
});
答案 0 :(得分:0)
You can also pass function into suorce instead of api url.
$("#location").autocomplete({
source: 'property-location/?city=' + $('[name=city]').val() + $(this).val(),
source: function(request, response) {
$.getJSON('property-location/', {
term: extractLast(request.term),
city: $('[name=city]').val()
}, response);
}
});