in reply to avoid time out

Without more information about your environment I can only offer generic help -

Option 1 - increase the timeout setting on you web server

Option 2 - speed up your server side script

My experience has been that it almost always pays to take the second option, since you often have to do that anyway. As a starting idea, you could look at caching results on the server.