本文介绍了如何中止当前的自动完成数据呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我遇到了jquery autocomplete的问题,其中要求是从数据库中提取数千条记录的列表并在自动完成下拉列表中呈现。 我在keydown事件上绑定数据加载,当我输入时间间隔为1秒或更短的任何字符时,它分别为每个字符渲染结果。 示例i按'a'而不是'j'而不是'a'而不是'x'而不是它将渲染结果最初匹配'a'而不是重新加载'aj'的结果而不是'aja'比'ajax'的最后一个。 我想要的行为就像是我按下另一个字符而不是取消旧请求并只渲染新结果。对于同样的尝试使用.abort()方法取消ajax调用,但它仍然是先渲染旧结果而不是使用新调用刷新结果。即使我在渲染旧结果之前输入了第二个字符。 请帮我解决这个问题。Hi,I am having an issue with jquery autocomplete where the requirement is to pull a list of thousands records from database and to render on autocomplete dropdown list.I have bind data load on keydown event, and when i type any character with a time interval of 1 sec or less than it render the result for every character respectively.Example i press 'a' than 'j' than 'a' and than 'x' than it will render result initially matching 'a' than reload with result for 'aj' than for 'aja' than last for 'ajax'.I want the behavior like if i press another character than it should cancel older request and render only new result. And for the same i tried with cancel ajax call using .abort() method, but still it is rendering old result first than refresh result with new call. Even i entered second another character before rendering old result.Please help me to solve this issue.推荐答案 这篇关于如何中止当前的自动完成数据呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-12 22:59