Okay, my situation is such: I need to send the contents of a JavaScript array to server where a PHP script will persist individual array entries in a MYSQL database. I am NOT using jQuery but I am about to integrate Prototype framework into my project.
I gather that the JS array can easily be converted to JSON using the toJSON() method provided by Prototype. I could then POST this to my script which would somehow de-JSONise the array and insert the values into DB.
But what I am also interested in is NOT using JSON data-interchange format, but converting the JS array into XML, which can be very easily parsed by the simplexml PHP extension (save myself some development time server-side). My question(s) are thus: should I go for JSON or XML? and How could I turn the JS array into XML? (is there a toXML() method like there is toJSON() in Prototype?)
I am aware of the great variety of very similar questions, but they all seem to ask this question the other way around... converting JSON to JS arrays, and many are jQuery related. So please help me, even if this is potentially a duplicate and you may have answered this some place else.