0
对不起,如果我无法说清楚。如何使用jquery自动完成功能从数据库中获取2值
我有2列item_description
和item_price
一个表,我有2个input
标签,一个是项目名称等为价格。
我使用jQuery自动完成让item_description
现在我想要什么,如果用户类型项目名称并选择一个从自动提示价格input
字段应自动填充选定项目名称。
这里是我的PHP页面:
$searchTerm = $_GET['term'];
$query = $db->query("SELECT * FROM items WHERE item_description LIKE '%".$searchTerm."%' ORDER BY item_description ASC");
while ($row = $query->fetch_assoc()) {
$data[] = $row['item_description'];
$data[] = $row['item_price'];
}
//return json data;
echo json_encode($data);
这里是JS:
$(".itemName").autocomplete({
source: '../ajxphp/itemsname_autoSuggest.php',
});
希望能得到一些帮助,感谢名单提前。
@gerry thnx bro编辑我的帖子 –
打电话给某个* bro *听起来不太专业,另一个人可能会略微冒犯它。只是下次通信提示。 :) –