Is it possible to have a php script pause at a certain point wait for an ajax response, then continue executing?
If not, what is the most appropriate way to store the开发者_Python百科 current state of a script (all defined variables ect) untill it in invoked again?
Making it wait for an ajax response which could never come sounds like a very bad plan (apart from being impossible due to the nature of http as a stateless protocol).
What's wrong with using session to persist user data (you can store objects in the session)? It won't serialize the whole state automagically though.
Not how php works, or ajax really either. Each request is independent. You can use a session.
I think you are looking for Cometlink text - which is a form of reverse Ajax which holds the connection open indefinitely - although I don't think you'd have a PHP script just wait for it...
If you want to get in your php script response that you would normally access via ajax then just use curl functions. Curl will wait for the response to arrive.
精彩评论