Taking your previous questions on the same subject into account another question submerges: "Does it have to be xml?" How about json?
To encode the data as json on the client you can use jquery-json, which takes only 2kb in the minimized version
var jsondata = {
sender: "CATS",
subject: "All Your Base",
items: []
};
for(var i=0; i<8; i++) jsondata.items.push(i);
$.ajax({
url: "http://localhost/test.php",
type: "post",
dataType: "json",
data: $.toJSON(jsondata),
contentType: "application/json; charset=utf-8",
Then your server-side php script can decode the data with
json_decode(), and you will get a native php array/hash according to the json-representation of the javascript object/hash.
For sending data back to the client you can use
json_encode(). You get a json representation of your php array and since dataType: "json" was set, jquery will return a native javascript object holding these values/properties.