I have a function that gets called whenever a user makes a keypress command. It does a bunch of stuff that is context dependent on the project I'm working on, so I'll leave out the source code. But it has an AJAX request. I want to exit from this function, wherever it may be in its execution, and call it again immediately when a new key is pressed. Currently it still finishes executing the function even when a new key is pressed.
Asked
Active
Viewed 325 times
1 Answers
1
you can use abort() to stop any AJAX requests. Please refer to this page for details.

namu
- 186
- 1
- 13
-
Perfect. Thank you! I'll mark it as correct when it lets me in a couple minutes. – Evan Hessler Sep 18 '18 at 22:47
-
@EvanHessler my pleasure :) – namu Sep 18 '18 at 23:00