The tricky part with this whole thing is that it is asynchronous. I'm not entirely sure if an AJAX call is 100% reliable or not OR whether the onCompletion call even knows anything about which object in your javascript called it in the first place.
I've used the Yahoo User Interface (YUI) tools and their AJAX object has some kind of timeout parameter as I recall.
In your case, the var index is defined inside a function so only code within that function will have visibility to it. You might consider defining the var index OUTSIDE the function that gets your towns. On the other hand, you might end up creating a number of requests to the same page, all of which return and execute. I think the YUI ajax object knows how to properly cancel a request that has timed out.
Sorry I can't be more help.