javascript - Jquery button binds ajax query event, how to optimize?
PHPz2017-05-16 12:58:36
0
4
402
For example, limit the number of queries, limit the query interval, cache query results, etc. I have no experience in the specific method, so please give me some advice.
The timer sets the click state of the button (clicking again within 3 seconds after clicking will have no effect), or define a state value and reset the state value when the callback is completed
If you click a button to send ajax and limit the frequency of clicking the button, you can use
防抖动
Instance analysis of debouncing and throttling
Make a timer. Click again if the time is less than the timer to cancel the last ajax sent.
The timer sets the click state of the button (clicking again within 3 seconds after clicking will have no effect), or define a state value and reset the state value when the callback is completed
Add a time lock