How to trigger an onkeyup event that's delayed until a user pauses their typing?

后端 未结 7 758
生来不讨喜
生来不讨喜 2020-11-29 03:16

I have a textarea where people enter some text (naturally), and I want to make it so that an AJAX request is made every now and then to get some suggestions regarding what t

7条回答
  •  孤城傲影
    2020-11-29 03:48

    If you are using this functionality alot around the site and don't want to keep track of all of the setTimeout refs etc then i packaged this up into a plugin available here.

    The plugin adds a few options to the normal $.ajax method for buffering and canceling previous ajax calls.

提交回复
热议问题