Question about concurrent ajax requests, keeping track of which one is completing

Question about concurrent ajax requests, keeping track of which one is completing

I have a question for the jQuery gurus. I am working on a page with several checkboxes. As the users click checkboxes I want to show a loading indicator next to each one, then when the request completes I will replace the loading indicator with some data that was returned in the ajax request. I'm having trouble figuring out which loading indicator to replace when the ajax request completes. I think it will work if I pass in the loading indicator's parent element ID to the ajax request, then on the server side I will echo it back out. This way the success method will know which element to update.  Is that the best way?

If the request fails for some reason then I won't get the ID back and I won't be able to turn off the loading indicator.

One other thing, I also need to disable the submit button on the form while any of these are loading. I plan to keep an incrementing/decrementing a global variable in the beforeSend and complete methods. If the complete method found the variable to be zero after decrementing then it would reenable the submit button. If there is a better way to do this, please let me know. I looked at .ajaxStart() but it seems there is no counterpart to it, so I would still need to manually keep track of when requests are ending.

thanks,
-Ryan