I wanted to do some queries in my DB through AJAX and had troubles with the response. JSON is integrated in Prototype, but not in PHP and i didn’t wanted to use any PHP toolkit. I wanted to use XML feedback with an interpreter on the client side and a manual output on the server side.
Finally, i never got the xml parser to work on the client side, so I thought about the good old days of DOS, when I programmed in QBasic and QuickC. Sequential file with \t and \n separated data :
+ each item is on its line, separated from the other by a \n
+ each field is divided from the others by a \t
This way, you can create a manual parser in around 4 lines of javascript by using the split() function :
var myresponsefields = request.responseText.split('\t');
then paste the data at the good place. Prototype helps a lot there with helper functions like Array.each() wich let you call a function for each item of the array.