Closed UnexpectedMaker closed 3 years ago
You can call setOptions to set additional params when the dropdown value changes:
$('#autocomplete').autocomplete('setOptions', { params: { customValue: '...' } });
In this case, params will be used as query string parameters.
How do you handle later-bound elements ,like :
$(document).on('click', '.add_line', function(){
var tr=$(this).closest("tr");
var clone = tr.clone();
clone.insertAfter(tr);
// 给新加行的绑定自动不全
clone.find('[name="title[]"]').autocomplete({
serviceUrl: "{:url('admin/caigou/caixunjia_ing_json')}",
noSuggestionNotice: "未匹配到数据,换个关键字试试。",
minChars:0,
onSelect: function (suggestion) {
var tr = $(this).closest("tr");
tr.find("input[name='xinghao[]']").val(suggestion.xinghao);
tr.find("input[name='guige[]']").val(suggestion.guige);
tr.find("input[name='jia[]']").val(suggestion.jia);
comput.apply(this);
}
})
Hi, I love this implementation of autocomplete, but I'm wanting to also pass in a dynamic variable (from a dropdown list) so the service url know's where I am wanting to pull the data from.
I can't seem to work out how to do this. Is is possible?
Thanks :)