Jquery自动完成
$("input#txtaddkey").autocomplete({ source: "keyword.PHP",minLength: 2 });
$fetch = MysqL_query("SELECT * FROM o_keyword where keyword like '%" . $query . "%'"); while ($row = MysqL_fetch_array($fetch,MysqL_ASSOC)) { $row_array['id'] = $row['id']; $row_array['keyword'] = $row['keyword']; array_push($return_arr,$row_array); } echo json_encode($return_arr);
JSON数据输出
[{"id":"2","keyword":"Games"},{"id":"3","keyword":"Goa"}]
在键入“Ga”时,我在前端获得空li标签.