Name

XMLHttpRequest

Synopsis

LZX: XMLHttpRequest
JavaScript: XMLHttpRequest
Type: Class
Access: public
Topic: Components.RPC
Declared in: lps/components/rpc/ajax.lzx

Description

Implements XMLHttpRequest http://developer.apple.com/internet/webcontent/xmlhttpreq.html http://www.whatwg.org/specs/web-apps/current-work/#scripted-http Incompatibilites with spec: Proxied: SOLO: + Cannot set HTTP headers (except maybe content-type?) + Cannot access response headers + Cannot send raw POST data(?) - but we could eventually send verbatim XML POST data payload using XML.sendAndLoad(). Q: Does XML.sendAndLoad() handle a single text content node with no tags around it? + Cannot send repeated query args in a POST using LoadVars + Username/password HTTP Auth args to send() not supported. Can user/password be sent in URL? We cannot set our own auth headers in SOLO mode... Questions: In the spec, when you use XMLHTTPRequest.send(string), what is it supposed to do when the content is a string? Is it supposed to send the text verbatim as the POST content body?

Superclass Chain

node (LzNode) » XMLHttpRequest

Known Subclasses

Details

Properties (5)

readyState
<attribute name="readyState" type="number" value="0" />
public var readyState : Number;
readyState Object status integer: 0 Uninitialised The initial value. 1 Open The open() method has been successfully called. 2 Sent The send() method has been successfully called, but no data has yet been received. 3 Receiving Data is being received, but the data transfer is not yet complete. 4 Loaded The data transfer has been completed.
responseText
<attribute name="responseText" type="string" value="" />
public var responseText : String;
responseText String version of data returned from server process
responseXML
<attribute name="responseXML" />
public var responseXML;
responseXML DOM-compatible document object of data returned from server process
status
<attribute name="status" />
public var status;
status Numeric code returned by server, such as 404 for "Not Found" or 200 for "OK"
statusText
<attribute name="statusText" />
public var statusText;
statusText String message accompanying the status code

Methods (8)

abort()
<method name="abort" />
public function abort();
abort() Stops the current request
getAllResponseHeader()
<method name="getAllResponseHeader" args="hname" />
public function getAllResponseHeader(hname);
getResponseHeader("headerLabel") Returns the string value of a single header label
getAllResponseHeaders()
<method name="getAllResponseHeaders" />
public function getAllResponseHeaders();
getAllResponseHeaders() Returns complete set of headers (labels and values) as an LzParam
ondataHandler()
<method name="ondataHandler" />
public function ondataHandler();
onerrorHandler()
<method name="onerrorHandler" />
public function onerrorHandler();
open()
<method name="open" args="method, url, async, uname, password" />
public function open(method, url, async, uname, password);
open("method", "URL"[, asyncFlag[, "userName"[, "password"]]]) Assigns destination URL, method, and other optional attributes of a pending request
send()
<method name="send" args="content" />
public function send(content);
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
setRequestHeader()
<method name="setRequestHeader" args="key, val" />
public function setRequestHeader(key, val);
setRequestHeader("label", "value") Assigns a label/value pair to the header to be sent with a request

Events (1)

onreadystatechange
<attribute name="onreadystatechange" />
public event onreadystatechange;

LZX Synopsis

<class name="XMLHttpRequest" extends=" LzNode ">
  <attribute name=" readyState " type="number" value="0" />
  <attribute name=" responseText " type="string" value="" />
  <attribute name=" responseXML " />
  <attribute name=" status " />
  <attribute name=" statusText " />
  <method name=" abort " />
  <method name=" getAllResponseHeader " args="hname" />
  <method name=" getAllResponseHeaders " />
  <method name=" ondataHandler " />
  <method name=" onerrorHandler " />
  <event name=" onreadystatechange " />
  <method name=" open " args="method, url, async, uname, password" />
  <method name=" send " args="content" />
  <method name=" setRequestHeader " args="key, val" />
</class>

JavaScript Synopsis

public XMLHttpRequest extends  LzNode  {
  public var readyState  : Number;
  public var responseText  : String;
  public var responseXML ;
  public var status ;
  public var statusText ;
  prototype public function abort ();
  prototype public function getAllResponseHeader (hname);
  prototype public function getAllResponseHeaders ();
  prototype public function ondataHandler ();
  prototype public function onerrorHandler ();
  prototype public event onreadystatechange ;
  prototype public function open (method, url, async, uname, password);
  prototype public function send (content);
  prototype public function setRequestHeader (key, val);
}