[英]tokeninput jquery php : show all results ever
我需要有關腳本的幫助。
我創建我的文件PHP:
# Perform the query
$query = sprintf("SELECT ID,CATEGORIA from INTUITcategoria ORDER BY CATEGORIA", mysql_real_escape_string($_GET["q"]));
$arr = array();
$rs = mysql_query($query);
# Collect the results
while($obj = mysql_fetch_object($rs)) {
$arr[] = $obj;
}
# JSON-encode the response
$json_response = json_encode($arr);
# Return the response
echo $json_response;
和JSON結果似乎還可以,這是:
{"ID":"73","CATEGORIA":"RADIOMICROFONI"}, {"ID":"68","CATEGORIA":"ACCESSORI RADIOMICROFONI"}, {"ID":"34","CATEGORIA":"ACCORDATORI "}, ............
現在以這種方式設置我的html文件:
> <div>
> <input type="text" id="demo-input-facebook-theme" name="blah2" />
> <input type="button" value="Submit" />
> <script type="text/javascript">
> $(document).ready(function() {
> $("#demo-input-facebook-theme").tokenInput("../categorieautocomplete.php",
> {
> theme: "facebook"
> });
> });
> </script>
> </div>
但是我有一個問題。 當我在輸入文本中輸入“ ACC”時,我會收到整個列表,而不是在“ ACC”上進行過濾。
有解決這個問題的想法嗎?
提前致謝
斯特凡諾
$("#demo-input-facebook-theme").tokenInput("../categorieautocomplete.php",
您沒有將參數傳遞給腳本,因此,如果該參數為空,則它將為您提供所有行。 您需要將“ q”參數傳遞給腳本。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.