Reputation: 97
I changed an XMLDocument localy using javascript. How do I save it on the server? I tried the following:
if (window.XMLHttpRequest){ // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else{ // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("GET","./path/to/phpfile/file.php?newdocument="+newxmldocument,true);
xmlhttp.send();
In the php-file I wanted to do something like this:
$file = "./path/to/xmlfile/xmlfile.xml";
$dom = new DOMDocument();
$dom = $_REQUEST['newdocument'];
$dom->save($file);
This does not work, however.
Is there an easy way to save the XMLDocument object the php-file recieves?
Upvotes: 1
Views: 155