Jquery UI对某些单词

时间:2016-12-25 09:05:38

标签: php jquery jquery-ui autocomplete jquery-ui-autocomplete

<script type="text/javascript">
$(function() {
$( "#customers" ).autocomplete({
    source: 'search.php'
});
});
</script>
<div class="ui-widget"><input id="customers" name="Cno" placeholder="Customer Name"></div>

的search.php

<?php include('header.php');
//get search term
$searchTerm = $_GET['term'];
//get matched data from skills table
$query = $db->query("SELECT * FROM customers WHERE Customer_Name LIKE '%".$searchTerm."%' ORDER BY Customer_Name ASC");
while ($row = $query->fetch_assoc()) {
$data[] = $row['Customer_Name'];
}
//return json data
echo json_encode($data);
?>

search from keyword gulf

enter image description here enter image description here

请检查第一个屏幕截图,按关键字搜索“海湾”没有显示,但是当我搜索“海湾r”然后显示数据时,我还附加了搜索关键字'abd'仅3个字母,然后它也运作正常,但为什么这不适用于'海湾'

0 个答案:

没有答案