我使用loopj的tokeninput作为我的php / mysql列表。
但我不知道用过“q”参数。
这是我使用插件的html文件:
$(document).ready(function() {
$("#demo-input-facebook-theme").tokenInput("../categorieautocomplete.php", {
theme: "facebook"
});
});
有人解决了这个问题吗?
答案 0 :(得分:0)
如果您有以下内容的列表:
你发送?q=H
到PHP,它应该只返回:
对于?q=He
,它应该只返回:
您的脚本必须接受名为q的GET参数,该参数将包含要搜索的术语。例如。 http://www.example.com/myscript?q=query
您的脚本应按以下格式输出JSON搜索结果:
[ {"id":"856","name":"House"}, {"id":"1035","name":"Desperate Housewives"}, ... ]
答案 1 :(得分:0)
好的,我这样解决了这个问题:
在我的HTML文件关联中" q"到$ modify:
<input type='text' id='demo-input-facebook-theme' name=modify />
<script type='text/javascript'> $(document).ready(function() { $('#demo-input-facebook-theme').tokenInput('categorieautocomplete.php?q=$modify', { theme: 'facebook' ,
并进入我的PHP文件更改查询:
$query = ("SELECT ID,CATEGORIA from INTUITcategoria WHERE CATEGORIA LIKE '%{$q}%' ORDER BY categoria");
感谢&#39;很多人。
最诚挚的问候。
斯特凡诺