XMLHttpRequest sending XML to PHP server

adowlilla

New Member
I was wondering if I could send some data from my client-side (2d application using HTML5's canvas) to the server-side in the XML format?I tried something like this:\[code\]function send_xml_data_to_server(xml, url) { var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST", url, true); xmlhttp.setRequestHeader('Content-Type', 'text/xml'); xmlhttp.send(xml); xmlhttp.onreadystatechange = function() { callback_response_from_server(xmlhttp); }}\[/code\]Because in the informations that I must send to the server-side, it contains a few texts and it doesn't seem to work quite right with the the MIME:\[code\]xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\[/code\]But when I'm on the server-side I checked $_POST but there is nothing inside it, the same for $_REQUEST.So, at the end, I was wondering if it is even possible to send XML data to the server-side PHP using XMLHttpRequest?Thanks!
 
Back
Top