我正在使用TokenInput插件,但在尝试按不同参数搜索2个输入字段时遇到了一些问题。它们都在jquery.tokeninput.js中默认搜索,即使我在两个调用中都设置了“propertyToSearch”选项。
<script type="text/javascript">
$(document).ready(function() {
$("#your_dealership").tokenInput("_include/cpr_script.php", {
theme: "facebook",
tokenLimit: 1,
preventDuplicates: true,
propertyToSearch: "alias",
hintText: "Find Your Dealership"
});
$("#rooftop_id").tokenInput("_include/cpr_script.php", {
theme: "facebook",
tokenLimit: 1,
preventDuplicates: true,
propertyToSearch: "id",
hintText: "Find Your Dealership"
});
});
</script>
返回的JSON对象如下所示:
{id:9880, alias:Longo Lexus, city:El Monte, state:California}
目前,我已将“alias”设置为jquery.tokeninput.js中的propertyToSearch,但我需要让它按id&amp;别名或每个输入字段都有一个单独的输入字段。
提前致谢!
答案 0 :(得分:0)
找到解决方案。我正在使用WHERE子句中的输入值搜索我的脚本的SQL查询。如果搜索来自id输入,我不得不再进行一次查询。