JQuery UI 自动完成返回所有值

发布于 2024-10-06 11:24:57 字数 360 浏览 0 评论 0原文

我有以下代码:

$("#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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文