开发者

JQuery UI Autocomplete returning all values

开发者 https://www.devze.com 2023-01-29 02:48 出处:网络
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 retu

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 a开发者_JAVA百科ll cases.

How can i send the correct informacion from JS to PHP with the simplest form.


Here is the explanation : http://www.simonbattersby.com/blog/jquery-ui-autocomplete-with-a-remote-database-and-php/

Regards

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号