<XMLHttpRequest>
An implementation of XMLHttpRequest (also called "AJAX") for compatibility in SWF runtimes
JavaScript: lz.XMLHttpRequest
This class implements the XMLHTTPRequest as
specified by the WHATWG consortium.
In SOLO deployed applications, this class departs from the specification in these ways:
- Cannot set HTTP headers
- Cannot access response headers
- Cannot send raw POST data
- Cannot send repeated query args in a POST using LoadVars
- Username/password Auth args to send() not supported
<script>
function loadXMLDoc(url) {
var req = new lz.XMLHttpRequest();
req.onreadystatechange = processReqChange;
req.open("GET", url, true);
req.setRequestHeader('X-Test', 'one');
req.setRequestHeader('X-Test', 'two');
req.send(null);
}
function processReqChange(request) {
Debug.debug("processReqChange: req.readyState %w", request.readyState);
// only if request shows "loaded"
if (request.readyState == 4) {
// only if "OK"
if (request.status == 200) {
Debug.debug("arg = %w", request);
Debug.debug("request.status: %w", request.status);
Debug.debug("request.responseText: %w", request.responseText);
Debug.debug("request.responseXML %w:", request.responseXML);
Debug.debug("request.getAllResponseaders:",
request.getAllResponseHeaders());
} else {
Debug.debug("There was a problem retrieving the XML data: %w\n",
request.statusText);
}
}
}
</script>
Attributes inherited from <node>
classroot, cloneManager, data, datapath, defaultplacement, id, ignoreplacement, immediateparent, inited, initstage, name, nodeLevel, options, parent, placement, styleclass, subnodes, transition
Methods
-
-
Stops the current request
-
-
XMLHttpRequest.getAllResponseHeader(hname:String);
Returns the string value of a single header label
-
-
XMLHttpRequest.getAllResponseHeaders();
Returns complete set of headers (labels and values) as an LzParam
-
-
XMLHttpRequest.getResponseHeader(hname:String);
Returns the string value of a single header label
-
-
XMLHttpRequest.handleResponse(dreq);
-
-
XMLHttpRequest.ondataHandler();
-
-
XMLHttpRequest.onerrorHandler();
-
-
XMLHttpRequest.open(method:String!, url:String!, async:Boolean, uname:String, password:String);
Assigns destination URL, method, and other optional attributes of a pending request
-
-
XMLHttpRequest.send(content:*);
Transmits the request, optionally with postable string or DOM object data
In serverless mode, there's no Flash API to post a raw data string in the POST body.
Doesn't support "content" arg yet for serverless operation
-
-
XMLHttpRequest.setRequestHeader(key:String, val:String);
Assigns a label/value pair to the header to be sent with a request
Methods inherited from <node>
animate, applyConstraintMethod, applyData, childOf, completeInstantiation, construct, createChildren, dataBindAttribute, destroy, determinePlacement, getOption, getUID, init, lookupSourceLocator, releaseConstraint, releaseConstraintMethod, searchImmediateSubnodes, searchSubnodes, setOption, setSelected, updateData