开发者

AJAX - how to make autocomplete/autosuggestion and show results outside form, in table

开发者 https://www.devze.com 2022-12-25 14:17 出处:网络
im trying to make a simple page with search engine. i read, that if i want to implement autocomplete/autosuggest with form, i have to use ajax. thats ok for me. there are a l开发者_StackOverflowot sol

im trying to make a simple page with search engine. i read, that if i want to implement autocomplete/autosuggest with form, i have to use ajax. thats ok for me. there are a l开发者_StackOverflowot solutions on the intenret, but unfortunetly all of them is the same script :/ and thats fine for me :) but i want to go further. i want to show autosuggest results in table for example below search form. the data is stored in a simple array (eventualy, source mysql) i know that kind of script isnt easy to write, so i ask you to give me a hint or something. trivial solution is use php, but this needs submit button.

help, im stuck :)


You have to follow steps given below

1] Apply onkeyup on the textfield and called ajax request

2] findings = select * from artists where name like "params[]%"
where, params[] is the content of the textfield
findings is ur variable which should pass to the view as response.

3] Called a partial (view) in which you create a table depending on the response and replace a div on each ajax request.

0

精彩评论

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