我正在尝试设置自动填充字段.
我读了JQuery UI文档,但是所有的例子都假设源是一个静态的项目列表,JQuery将从中选择匹配的条目(我的意思是静态=列表是完整的,不依赖于用户键入的内容).
以下是“远程数据源”示例中的代码:
$( "#birds" ).autocomplete({
source: "search.php",...
我希望JQuery调用search.php?query = mytext(此URL返回匹配项列表)因为我需要使用PHP在数据库中查找建议.
有没有办法做到这一点?也许我不懂文档?
Autocomplete can be customized to work with various data sources,by just specifying the source option. A data source can be:
- an Array with local data
- a String,specifying a URL
- a Callback
并进一步下来
When a String is used,the Autocomplete plugin expects that string to point to a URL resource that will return JSON data. It can be on the same host or on a different one (must provide JSONP). The request parameter “term” gets added to that URL. The data itself can be in the same format as the local data described above.
你试过你给的代码吗?它应该调用url search.php?term = mytext
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。