我有几个jQuery UI的对象,他们都有一个类似的回调:如何将参数传递给jQuery UI的回调函数
$(function() {
$("#my_list").autocomplete({
source: function(request, response) {
$.ajax({
type: "POST",
url: "api",
data: {
term: request.term,
},
success: response,
dataType: 'json',
minLength: 0,
});
},
minLength: 0,
select: function(event, ui) {
$('something').appendTo("#another_list");
}
}
});
});
如果我可以通过“my_list”和“another_list”有作为参数,则代码会更干净。 这怎么办?
我不明白你想在哪个函数中得到“my_list”和“another_list”作为参数 – PaoloCargnin