HTML
$( "#searchbox" ).autocomplete({
source: function selectVal(request, response) {
var value = $("#dropdown_btn").val();
$.ajax({
url:"search.php",
type:"post",
dataType:"json",
data:{value:value},
success:function(data) {
response(data);
}
});
}
});
JS
我将整个json数据自动完成,但没有根据搜索值进行排序。
{{1}}
答案 0 :(得分:0)
试试这个
var value = $("#dropdown_btn").val();
$( "#searchbox" ).autocomplete({
source: function( request, response ) {
$.ajax({
url:"search.php",
type:"post",
dataType: "jsonp",
data:{value:value},
success: function( data ) {
response( data );
}
});
}
});