admin管理员组文章数量:1434978
I have a jQuery UI autoplete form that fetched data from remote source, but it bees erratic when connection is slow,(queuing up the requests, and messing up results). How we can hold request from firing until user pauses.
I have a jQuery UI autoplete form that fetched data from remote source, but it bees erratic when connection is slow,(queuing up the requests, and messing up results). How we can hold request from firing until user pauses.
Share Improve this question edited Jul 31, 2012 at 13:08 Andrew Whitaker 126k32 gold badges295 silver badges308 bronze badges asked Jul 31, 2012 at 5:32 ducktypedducktyped 4,5024 gold badges28 silver badges39 bronze badges 2- what does "user pause" mean in this context? Can you define it somehow? – eis Commented Jul 31, 2012 at 5:43
- Would this do the job: stackoverflow./questions/4220126/… – eis Commented Jul 31, 2012 at 5:48
1 Answer
Reset to default 7I think the delay
option should work for you:
The delay in milliseconds the Autoplete waits after a keystroke to activate itself. A zero-delay makes sense for local data (more responsive), but can produce a lot of load for remote data, while being less responsive.
By default, it's 300 (ms) but you should increase it to suit your needs.
$("#my-input").autoplete({
/* options */,
delay: 750
});
Compare the following two examples for instance:
- Using the default (300 ms): http://jsfiddle/q4Xkd/
- Using 750 ms: http://jsfiddle/x3EkS/
本文标签: javascriptfire ajax request only when user pauses in jquery UI autocompleteStack Overflow
版权声明:本文标题:javascript - fire ajax request only when user pauses in jquery UI autocomplete - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745645114a2668089.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论