JQuery UI 自动完成返回所有值
我有以下代码:
$("#auto").autocomplete({ 来源:“js/search.php”, 最小长度:“3”});
这段代码被分配给一个输入文本框,我在其中输入一个名称,在 3 个字母之后,它应该返回具有相似字母的字母。就我而言,它返回所有值,甚至是那些与已输入的 3 个字母无关的值。我的问题是:
如何向我的 search.php 文件发送输入中的值,以便它应该知道要搜索什么。目前它正在搜索所有内容。我检查了 php 的值,它是空的。由于对 mysql 的查询使用 LIKE '%VARIABLE%' 并且变量为空,因此它会搜索 '%%',这都是情况。
我如何以最简单的形式将正确的信息从 JS 发送到 PHP。
I have the following code:
$("#auto").autocomplete({
source: "js/search.php",
minLength: "3" });
This code is assign to an input text box where i type a name and after 3 letters it should return the ones that have similar letters. For my case it is returning all values, even those not related to the 3 letters already typed. My question is:
How to send my search.php file the value inside the input so it should know what to search for. For the moment it searches for everything. I checked the value that was going to php and it was empty. Since the query to mysql uses LIKE '%VARIABLE%' and the variable is empty it searches for '%%' which is all cases.
How can i send the correct informacion from JS to PHP with the simplest form.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解释如下:
http://www.simonbattersby。 com/blog/jquery-ui-autocomplete-with-a-remote-database-and-php/
问候
Here is the explanation :
http://www.simonbattersby.com/blog/jquery-ui-autocomplete-with-a-remote-database-and-php/
Regards