[英]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.