SwafAsync.js File Reference


Functions

function SwafAsync ()
 Implements asynchronous server requests (aka XMLHttpRequest).

Function Documentation

function SwafAsync  ) 
 

Implements asynchronous server requests (aka XMLHttpRequest).

SYNOPSIS

  var req = new SwafAsync();
  req.setHandler( function(req) {
      // insert the results into the existing <div id="results">...
      if( req.isStatusOk() ) 
        req.insertBody( req.clearNode( document.getElementsById('results') ) );
  } );
  req.postForm();

create an XMLHttpRequest object - browser dependent. XMLHttpRequest

post current form values. Posts a form document asynchronously in the background. String uri (optional) the URI of the server-side script. If no URI is given, the action of first form in the document is used. Array names (optional) the names of the form elements to be posted. If no names list is given, then all the elements are posted.

post arbitrary data. Posts arbitrary name/value pairs to a server-side script. String uri The URI of the server-side script. Array names A list of argument names. Array values A list of argument values.

Interprets response text as a JSON object. String text (optional). JSON text - if none is given takes the response of the current request JSON the text translated into a JSON object

Sets the handler that is to be called when the request is complete. The handler function is called with one argument - the corresponding SwafAsync object. function handler the handler to be called on request completion

This is called by the browser when the request's state changes.

Inserts an XML response into the current document under a given node. node node the node under which the document shall be added String elementname (optional) the name of the element in the async request result that contains the nodes to be added. If none is given, "response" is assumed.

Imports an XML tree into the (HTML) document. Called by insertBody() which one should use in preference. node source the node to copy node target the node under which the copy shall be stored

Removes all the childs of a node. The node passed is then returned. This is a conveniency function. Use it i.e. like this:

  req = new SwafAsync();
  ...
  req.insertBody( req.clearNode( document.getElementById( 'test' ) ) );

node node node the node to clear

Check the status of a completed request. Status "200" or "0" is treated as ok. boolean true if status is ok

the current request XMLHttpRequest


Generated on Sat May 19 01:18:28 2012 for Big Sister Web Application Framework by  doxygen 1.4.5