我有以下代码调用 jquery 自动完成小部件:
$(function() {
$( "#vendor_name" ).autocomplete({
source: 'vendor_names.php',
minLength: 3
})
});
我的vendor_names.php
文件看起来像:
<?php
include("include/db_connect.php");
$query = "select VendorName from Vendor where VendorCancelDate is NULL order by
VendorName";
$result = mssql_query($query);
while ( $record = mssql_fetch_array($result) ){
$vendors[] = array('label' => $record['VendorName']);
}
echo json_encode($vendors);
?>
但是当我输入任何内容时,它总是会返回我查询中的所有内容。有任何想法吗?