HTTPTools.postXML
Description
Send a document to your server using a HTTP POST request. This function allows you to specify the encoding explicitly.
This example shows how to save your document in UTF-8 encoding:
IO.setSaveXMLFunction(function (uri, doc) {
HTTPTools.postXML(uri, doc, "UTF-8");
});
Note that setting the encoding will cause an XML prolog to be added to your document:
<?xml version="1.0" encoding="UTF-8"?>
<document>…</document>
Syntax
HTTPTools .postXML (uri : String, doc : XopusDocument[, encoding : String][, callback : Function][, headers : Object]) : String
Arguments
- uri
-
String. The server URL to POST to. - doc
-
XopusDocument. The DOM document to POST to the server. - encoding
-
String. The encoding to use for the serialized DOM, e.g."UTF-8". (Optional) - callback
-
Function. This function is called when the server response is received. It will be called with the native XmlHttpRequest as only argument. This callback can be used to inspect response status headers for example. (Optional) - headers
-
Object. A list of headers to send with the request. This can be used to construct request in more specific ways. For example{Accept: "application/json"}. (Optional)
Return Value
String. Server response.