|
XMLHTTPRequest Object POST -
02-24-2009, 04:25 PM
Hello -
Trying to get an XML file written to a server from the client using the XMLHTTPRequest Object. As much as I can make out, the following code should work:
//Open file
xmlDocName = "uicfg.xml";
openXMLdoc(xmlDocName);
//Modify XML content
var xDoc=gXmlDoc.getElementsByTagName("PRESETS");
xDoc[0].getElementsByTagName("NAME1")[0].childNodes[0].nodeValue = document.getElementById("prePosName1").value
//XMLHTTPRequest connection - send file
var request = new ActiveXObject("Microsoft.XMLHTTP");
request.open("POST","./uicfg.xml",true);
request.onreadystatechange = function(){qwerty(request)};
request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
request.send(gXmlDoc);
The script modifies the XML content before writing it back to the server. I verified that those node changes seem to take by re-reading the modified node and displaying it in a test box.
The XMLHTTPRequest Object status comes back (in the qwerty function) as 200 indicating the server is happy to take the file (???). But the original file on the server remains unchanged.
The server is a bare bones server that doesn't have stuff like ASP or PHP or anything that I can personally write a handler for. And I don't know how to make a CGI script for it. So I'm sorta screwed that way. I'm using the XMLHTTPRequest object stuff on this web server to control a web cam so I know the AJAX stuff works (using GET).
Does anyone know how to properly send a file via AJAX like this so that the file simply gets written to the specified server file location?
Thanks for any help in advance...
|