Wait for function to finish before starting again.

Posted by Matthew Brown on Stack Overflow See other posts from Stack Overflow or by Matthew Brown
Published on 2010-12-22T22:35:38Z Indexed on 2010/12/22 22:54 UTC
Read the original article Hit count: 221

Filed under:
|
|
|

Good Morning,

I am trying to call the same function everytime the user presses a button. Here is what happens at the moment..

User clicks button -> Calls function -> function takes 1000ms+ to finish (due to animation with jQuery and AJAX calls)

What I want to happen is every time the user presses the button it adds the function to the queue, waits for the previous call to finish, and then starts..

Is this possible?

Sorry if my explanation is a bit confusing..

Thanks Matthew

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery