答案 0 :(得分:1)
答案 1 :(得分:1)
以下是我为上面的代码找到的解决方案
<。>在.js$("#names").autocomplete({
source: function(request , response){
$.ajax({
type: 'GET',
url: 'names.php',
data: "letter="+$("#names").val(), //request doesn't work here, I don't know why
success: function(data) {
var explode = data.split("|");
response(explode);
}
});
}
});
在php文件中
if(isset($_GET['letter'])){
$letter = $_GET['letter'];
$sql = "select name from name_list where name like '".$letter."%'";
$query = mysql_query($sql);
while($result = mysql_fetch_row($query)){
echo $result[0].'|';
}
}
答案 2 :(得分:0)
答案 3 :(得分:0)