Sappster 0 Newbie Poster

Hello all.
Got a slightly strange problem, which might be a little dificult to explain.
I have some AJAX code which uses javascript to call a php file that queries a database and returns data. Basically I have a problem with the order that things get executed once they are returned by the server. I have a function that makes the AJAX request and uses the xmlHttpRequestObjects handleReadyStatechange to call another function that handles the response. The problem is that the response handling function doesnt get called until the first function has completely finished execution. I was hoping to use this like you would a normal function call (i.e. the function making the call will wait at the point it makes the call until the called function has completed) however this isnt working. I even tried throwing in some busy waiting loops incase it was a time delay but this doesnt help.
sorry i know its a bit hard to read, its just a bit tricky to explain.