On 18/06/12 16:30, Chris Green wrote:
They basically say use json but that's just a way of encoding blobs of data really, not a way of sending it.
Indeed, but PHP can interpret the data and writing it to a database should be straightforward enough. The point is that the question/answer stuff has been shifted client-side and given you the stateful environment you were looking for.
One still has to fire off data from one server side process to the client side and get it back in a different, effectively unconnected, server side process.
Unconnected, but without any need to be connected, any more than your connection to (eg) MySQL is. The client side is basically just saying "store this" and "retrieve this" much as you do with MySQL (indeed your PHP scripts will probably be little more than wrappers around mysql commands). And they don't need to play ball with your wiki environment, they won't need to know anything about it.
Basically you get the environment you wanted (albeit in Javascript not PHP), and the http stuff is just there to serve your application to your browser and act as an intermediary for your connection to the database. At the "application" level you can do the "what's your favourite colour", wait for response, handle response logic, and only synchronise back to the database via "the web" as necessary.
I've not looked at Knockout before but I've just run through their sample code and I think it deserves a proper play....
Mark