xajax_core.js

This file contains the definition of the main xajax javascript core.

This is the client side code which runs on the web browser or similar web enabled application.  Include this in the HEAD of each page for which you wish to use xajax.

Summary
This file contains the definition of the main xajax javascript core.
Please see copyright.inc.php for a detailed description, copyright and license information.
This class contains all the default configuration settings.
This function will set a default configuration option if it is not already set.
The base document that will be used throughout the code for locating elements by ID.
The URI that requests will be sent to.
The request mode.
The Hyper Text Transport Protocol version designated in the header of the request.
The content type designated in the header of the request.
The delay time, in milliseconds, associated with the <xajax.callback.global.onRequestDelay> event.
The amount of time to wait, in milliseconds, before a request is considered expired.
The method used to send requests to the server.
The number of times a request should be retried if it expires.
The value returned by xajax.call when in asynchronous mode, or when a syncrhonous call does not specify the return value.
The maximum depth of recursion allowed when serializing objects to be sent to the server in a request.
The maximum number of members allowed when serializing objects to be sent to the server in a request.
Provides support for updating the browser’s status bar during the request process.
Constructs and returns a set of event handlers that will be called by the xajax framework to set the status bar messages.
Constructs and returns a set of event handlers that will be called by the xajax framework where status bar updates would normally occur.
Provides the base functionality for updating the browser’s cursor during requests.
Constructs and returns a set of event handlers that will be called by the xajax framework to effect the status of the cursor during requests.
Constructs and returns a set of event handlers that will be called by the xajax framework where cursor status changes would typically be made during the handling of requests.
This contains utility functions which are used throughout the xajax core.
Shorthand for finding a uniquely named element within the document.
Replace all occurances of the single quote character with a double quote character.
Replace all occurances of the double quote character with a single quote character.
Determine if the specified value contains special characters and create a CDATA section so the value can be safely transmitted.
Convert a javascript object or array into XML suitable for transmission to the server.
Deserialize a javascript object from an XML node.
Construct an XMLHttpRequest object dependent on the capabilities of the browser.
Insert the specified string of HTML into the document, then extract it.
Tests to see if the specified data is the same as the current value of the element’s attribute.
Build an associative array of form elements and their values from the specified form.
Used internally by xajax.tools.getFormValues to recursively get the value of form elements.
Used internally by xajax.tools._getFormValues to extract a single form value.
Detect, and if found, remove the prefix ‘on’ from the specified string.
Detect, and add if not found, the prefix ‘on’ from the specified string.
This contains the code and variables for building, populating and processing First In Last Out (FILO) buffers.
Construct and return a new queue object.
Maintains a retry counter for the given object.
Rewind the buffer head pointer, effectively reinserting the last retrieved object into the buffer.
Set or reset a timeout that is used to restart processing of the queue.
While entries exist in the queue, pull and entry out and process it’s command.
Push a new object into the tail of the buffer maintained by the specified queue object.
Push a new object into the head of the buffer maintained by the specified queue object.
Attempt to pop an object off the head of the queue.
Parse the response XML into a series of commands.
Contains the functions for javascript file and function manipulation.
Add a reference to the specified script file if one does not already exist in the HEAD of the current document.
Adds a SCRIPT tag referencing the specified file.
Locates a SCRIPT tag in the HEAD of the document which references the specified file and removes it.
Causes the processing of items in the queue to be delayed for the specified amount of time.
Prompt the user with the specified text, if the user responds by clicking cancel, then skip the specified number of commands in the response command queue.
Execute the specified string of javascript code, using the current script context.
Test for the specified condition, using the current script context; if the result is false, sleep for 1/10th of a second and try again.
Call a javascript function with a series of parameters using the current script context.
Constructs the specified function using the specified javascript as the body of the function.
Construct a javascript function which will call the original function with the same name, potentially executing code before and after the call to the original function.
Helper function used in the wrapping of an existing javascript function.
Assign an element’s attribute to the specified value.
Append the specified value to an element’s attribute.
Prepend the specified value to an element’s attribute.
Search and replace the specified text.
Delete an element.
Create a new element and append it to the specified parent element.
Insert a new element before the specified element.
Insert a new element after the specified element.
Assign a value to a named member of the current script context object.
Appends a value to a named member of the current script context object.
Prepend a value to a named member of the current script context object.
Add a LINK reference to the specified .css file if it does not already exist in the HEAD of the current document.
Locate and remove a LINK reference from the current document’s HEAD.
Attempt to detect when all .css files have been loaded once they are referenced by a LINK tag in the HEAD of the current document.
Create and return a form input element with the specified parameters.
Create a new input element under the specified parent.
Insert a new input element before the specified element.
Insert a new input element after the specified element.
Set an event handler.
Add an event handler to the specified element.
Remove an event handler from an element.
Create a blank callback object.
Create a timer to fire an event in the future.
Clear a callback timer for the specified function.
Execute a callback event.
The global callback object which is active for every request.
The response queue that holds response commands, once received from the server, until they are processed.
This array contains a list of codes which will be returned from the server upon successful completion of the server portion of the request.
This array contains a list of status codes returned by the server to indicate that the request failed for some reason.
An array of status codes returned from the server to indicate a request for redirect to another URL.
The array of command handlers that are currently available.
Initialize a request object, populating default settings, where call specific settings are not already provided.
Processes request specific parameters and generates the temporary variables needed by xajax to initiate and process the request.
Prepares the XMLHttpRequest object for this xajax request.
Initiates a call to the server.
Create a request object and submit the request using the specified request type; all request parameters should be finalized by this point.
This function is used internally by xajax to initiate a request to the server.
Abort the request.
Process the response.
This function attempts to determine, based on the content type of the reponse, what processor should be used for handling the response data.
Take the parameters passed in the command of the XML response and convert them to parameters of the args object.
Parses the child nodes of the command of the response XML.
Perform a lookup on the command specified by the response command object passed in the first parameter.
Called by the response command queue processor when all commands have been processed.
Shortcut to xajax.tools.$.
Contains shortcut’s to frequently used functions.
Shortcut to xajax.tools.$.
Shortcut to xajax.call.

xajax core javascript library

Please see copyright.inc.php for a detailed description, copyright and license information.

xajax. config

This class contains all the default configuration settings.  These are application level settings; however, they can be overridden by including a xajax.config definition prior to including the xajax_core.js file, or by specifying the appropriate configuration options on a per call basis.

Summary
This function will set a default configuration option if it is not already set.
The base document that will be used throughout the code for locating elements by ID.
The URI that requests will be sent to.
The request mode.
The Hyper Text Transport Protocol version designated in the header of the request.
The content type designated in the header of the request.
The delay time, in milliseconds, associated with the <xajax.callback.global.onRequestDelay> event.
The amount of time to wait, in milliseconds, before a request is considered expired.
The method used to send requests to the server.
The number of times a request should be retried if it expires.
The value returned by xajax.call when in asynchronous mode, or when a syncrhonous call does not specify the return value.
The maximum depth of recursion allowed when serializing objects to be sent to the server in a request.
The maximum number of members allowed when serializing objects to be sent to the server in a request.

Functions

setDefault

xajax.config.setDefault = function(option,
defaultValue)

This function will set a default configuration option if it is not already set.

option(string): The name of the option that will be set.
defaultValue(unknown): The value to use if a value was not already set.

Variables

waitCursor

xajax.config.setDefault('waitCursor',
false)
truexajax should display a wait cursor when making a request
falsexajax should not show a wait cursor during a request

statusMessages

xajax.config.setDefault('statusMessages',
false)
truexajax should update the status bar during a request
falsexajax should not display the status of the request

baseDocument

xajax.config.setDefault('baseDocument',
document)

The base document that will be used throughout the code for locating elements by ID.

requestURI

xajax.config.setDefault('requestURI',
xajax.config.baseDocument.URL)

The URI that requests will be sent to.

defaultMode

xajax.config.setDefault('defaultMode',
'asynchronous')

The request mode.

’asynchronous’The request will immediately return, the response will be processed when (and if) it is received.
’synchronous’The request will block, waiting for the response.  This option allows the server to return a value directly to the caller.

defaultHttpVersion

xajax.config.setDefault('defaultHttpVersion',
'HTTP/1.1')

The Hyper Text Transport Protocol version designated in the header of the request.

defaultContentType

xajax.config.setDefault('defaultContentType',
'application/x-www-form-urlencoded')

The content type designated in the header of the request.

defaultResponseDelayTime

xajax.config.setDefault('defaultResponseDelayTime',
1000)

The delay time, in milliseconds, associated with the <xajax.callback.global.onRequestDelay> event.

defaultExpirationTime

xajax.config.setDefault('defaultExpirationTime',
10000)

The amount of time to wait, in milliseconds, before a request is considered expired.  This is used to trigger the <xajax.callback.global.onExpiration event.

defaultMethod

xajax.config.setDefault('defaultMethod',
'POST')

The method used to send requests to the server.

’POST’Generate a form POST request
’GET’Generate a GET request; parameters are appended to the xajax.config.requestURI to form a URL.

defaultRetry

xajax.config.setDefault('defaultRetry',
5)

The number of times a request should be retried if it expires.

defaultReturnValue

xajax.config.setDefault('defaultReturnValue',
false)

The value returned by xajax.call when in asynchronous mode, or when a syncrhonous call does not specify the return value.

maxObjectDepth

xajax.config.setDefault('maxObjectDepth',
20)

The maximum depth of recursion allowed when serializing objects to be sent to the server in a request.

maxObjectSize

xajax.config.setDefault('maxObjectSize',
2000)

The maximum number of members allowed when serializing objects to be sent to the server in a request.

xajax. config. status

Provides support for updating the browser’s status bar during the request process.  By splitting the status bar functionality into an object, the xajax developer has the opportunity to customize the status bar messages prior to sending xajax requests.

Summary
Constructs and returns a set of event handlers that will be called by the xajax framework to set the status bar messages.
Constructs and returns a set of event handlers that will be called by the xajax framework where status bar updates would normally occur.

Functions

update

update: function()

Constructs and returns a set of event handlers that will be called by the xajax framework to set the status bar messages.

dontUpdate

dontUpdate: function()

Constructs and returns a set of event handlers that will be called by the xajax framework where status bar updates would normally occur.

xajax. config. cursor

Provides the base functionality for updating the browser’s cursor during requests.  By splitting this functionalityh into an object of it’s own, xajax developers can now customize the functionality prior to submitting requests.

Summary
Constructs and returns a set of event handlers that will be called by the xajax framework to effect the status of the cursor during requests.
Constructs and returns a set of event handlers that will be called by the xajax framework where cursor status changes would typically be made during the handling of requests.

Functions

update

update: function()

Constructs and returns a set of event handlers that will be called by the xajax framework to effect the status of the cursor during requests.

dontUpdate

dontUpdate: function()

Constructs and returns a set of event handlers that will be called by the xajax framework where cursor status changes would typically be made during the handling of requests.

xajax. tools

This contains utility functions which are used throughout the xajax core.

Summary
Shorthand for finding a uniquely named element within the document.
Replace all occurances of the single quote character with a double quote character.
Replace all occurances of the double quote character with a single quote character.
Determine if the specified value contains special characters and create a CDATA section so the value can be safely transmitted.
Convert a javascript object or array into XML suitable for transmission to the server.
Deserialize a javascript object from an XML node.
Construct an XMLHttpRequest object dependent on the capabilities of the browser.
Insert the specified string of HTML into the document, then extract it.
Tests to see if the specified data is the same as the current value of the element’s attribute.
Build an associative array of form elements and their values from the specified form.
Used internally by xajax.tools.getFormValues to recursively get the value of form elements.
Used internally by xajax.tools._getFormValues to extract a single form value.
Detect, and if found, remove the prefix ‘on’ from the specified string.
Detect, and add if not found, the prefix ‘on’ from the specified string.

Functions

$

xajax.tools.$ = function(sId)

Shorthand for finding a uniquely named element within the document.

sId(string): The unique name of the element (specified by the ID attribute), not to be confused with the name attribute on form elements.

Returns

objectThe element found or null.

Note

This function uses the xajax.config.baseDocument which allows xajax to operate on the main window document as well as documents from contained iframes and child windows.

See also

xajax.$ and xjx.$

doubleQuotes

xajax.tools.doubleQuotes = function(haystack)

Replace all occurances of the single quote character with a double quote character.

haystackThe source string to be scanned.

Returns

stringA new string with the modifications applied.

singleQuotes

xajax.tools.singleQuotes = function(haystack)

Replace all occurances of the double quote character with a single quote character.

haystackThe source string to be scanned.

Returns

stringA new string with the modification applied.

_escape

xajax.tools._escape = function(data)

Determine if the specified value contains special characters and create a CDATA section so the value can be safely transmitted.

data(string or other): The source string value to be evaluated or an object of unknown type.

Returns

stringThe string value, escaped if necessary or the object provided if it is not a string.

Note

When the specified object is NOT a string, the value is returned as is.

_objectToXML

xajax.tools._objectToXML = function(obj,
guard)

Convert a javascript object or array into XML suitable for transmission to the server.

objThe object or array to convert.
guardAn object used to track the level of recursion when encoding javascript objects.  When an object contains a reference to it’s parent and the parent contains a reference to the child, an infinite recursion will cause some browsers to crash.

Returns

stringthe xml representation of the object or array.

See also

xajax.config.maxObjectDepth and xajax.config.maxObjectSize

_nodeToObject

xajax.tools._nodeToObject = function(node)

Deserialize a javascript object from an XML node.

nodeA node, likely from the xml returned by the server.

Returns

objectThe object extracted from the xml node.

getRequestObject

Construct an XMLHttpRequest object dependent on the capabilities of the browser.

Returns

objectJavascript XHR object.

getBrowserHTML

xajax.tools.getBrowserHTML = function(sValue)

Insert the specified string of HTML into the document, then extract it.  This gives the browser the ability to validate the code and to apply any transformations it deems appropriate.

sValue(string): A block of html code or text to be inserted into the browser’s document.

Returns

The (potentially modified) html code or text.

willChange

xajax.tools.willChange = function(element,
attribute,
newData)

Tests to see if the specified data is the same as the current value of the element’s attribute.

element(string or object): The element or it’s unique name (specified by the ID attribute)
attribute(string): The name of the attribute.
newData(string): The value to be compared with the current value of the specified element.

Returns

trueThe specified value differs from the current attribute value.
falseThe specified value is the same as the current value.

getFormValues

xajax.tools.getFormValues = function(parent)

Build an associative array of form elements and their values from the specified form.

element(string): The unique name (id) of the form to be processed.
disabled(boolean, optional): Include form elements which are currently disabled.
prefix(string, optional): A prefix used for selecting form elements.

Returns

An associative array of form element id and value.

_getFormValues

xajax.tools._getFormValues = function(aFormValues,
children,
submitDisabledElements,
prefix)

Used internally by xajax.tools.getFormValues to recursively get the value of form elements.  This function will extract all form element values regardless of the depth of the element within the form.

_getFormValue

xajax.tools._getFormValue = function(aFormValues,
child,
submitDisabledElements,
prefix)

Used internally by xajax.tools._getFormValues to extract a single form value.  This will detect the type of element (radio, checkbox, multi-select) and add it’s value(s) to the form values array.

stripOnPrefix

xajax.tools.stripOnPrefix = function(sEventName)

Detect, and if found, remove the prefix ‘on’ from the specified string.  This is used while working with event handlers.

sEventName(string): The string to be modified.

Returns

stringThe modified string.

addOnPrefix

xajax.tools.addOnPrefix = function(sEventName)

Detect, and add if not found, the prefix ‘on’ from the specified string.  This is used while working with event handlers.

sEventName(string): The string to be modified.

Returns

stringThe modified string.

xajax. tools. queue

This contains the code and variables for building, populating and processing First In Last Out (FILO) buffers.

Summary
Construct and return a new queue object.
Maintains a retry counter for the given object.
Rewind the buffer head pointer, effectively reinserting the last retrieved object into the buffer.
Set or reset a timeout that is used to restart processing of the queue.
While entries exist in the queue, pull and entry out and process it’s command.
Push a new object into the tail of the buffer maintained by the specified queue object.
Push a new object into the head of the buffer maintained by the specified queue object.
Attempt to pop an object off the head of the queue.

Functions

create

xajax.tools.queue.create = function(size)

Construct and return a new queue object.

size(integer): The number of entries the queue will be able to hold.

retry

xajax.tools.queue.retry = function(obj,
count)

Maintains a retry counter for the given object.

obj(object): The object to track the retry count for.
count(integer): The number of times the operation should be attempted before a failure is indicated.

Returns

trueThe object has not exhausted all the retries.
falseThe object has exhausted the retry count specified.

rewind

xajax.tools.queue.rewind = function(theQ)

Rewind the buffer head pointer, effectively reinserting the last retrieved object into the buffer.

theQ(object): The queue to be rewound.

setWakeup

xajax.tools.queue.setWakeup = function(theQ,
when)

Set or reset a timeout that is used to restart processing of the queue.  This allows the queue to asynchronously wait for an event to occur (giving the browser time to process pending events, like loading files)

theQ(object): The queue to process upon timeout.
when(integer): The number of milliseconds to wait before starting/ restarting the processing of the queue.

process

xajax.tools.queue.process = function(theQ)

While entries exist in the queue, pull and entry out and process it’s command.  When a command returns false, the processing is halted.

theQ(object): The queue object to process.  This should have been crated by calling xajax.tools.queue.create.

Returns

trueThe queue was fully processed and is now empty.
falseThe queue processing was halted before the queue was fully processed.

Notes

  • Use xajax.tools.queue.setWakeup or call this function to cause the queue processing to continue.
  • This will clear the associated timeout, this function is not designed to be reentrant.
  • When an exception is caught, do nothing; if the debug module is installed, it will catch the exception and handle it.

push

xajax.tools.queue.push = function(theQ,
obj)

Push a new object into the tail of the buffer maintained by the specified queue object.

theQ(object): The queue in which you would like the object stored.
obj(object): The object you would like stored in the queue.

pushFront

xajax.tools.queue.pushFront = function(theQ,
obj)

Push a new object into the head of the buffer maintained by the specified queue object.  This effectively pushes an object to the front of the queue... it will be processed first.

theQ(object): The queue in which you would like the object stored.
obj(object): The object you would like stored in the queue.

pop

xajax.tools.queue.pop = function(theQ)

Attempt to pop an object off the head of the queue.

theQ(object): The queue object you would like to modify.

Returns

objectThe object that was at the head of the queue or null if the queue was empty.

xajax. responseProcessor

Summary
Parse the response XML into a series of commands.

Functions

xml

xajax.responseProcessor.xml = function(oRequest)

Parse the response XML into a series of commands.  The commands are constructed by calling xajax.parseAttributes and xajax.parseChildren.

oRequest(object): The request context object.

xajax.js

Contains the functions for javascript file and function manipulation.

Summary
Add a reference to the specified script file if one does not already exist in the HEAD of the current document.
Adds a SCRIPT tag referencing the specified file.
Locates a SCRIPT tag in the HEAD of the document which references the specified file and removes it.
Causes the processing of items in the queue to be delayed for the specified amount of time.
Prompt the user with the specified text, if the user responds by clicking cancel, then skip the specified number of commands in the response command queue.
Execute the specified string of javascript code, using the current script context.
Test for the specified condition, using the current script context; if the result is false, sleep for 1/10th of a second and try again.
Call a javascript function with a series of parameters using the current script context.
Constructs the specified function using the specified javascript as the body of the function.
Construct a javascript function which will call the original function with the same name, potentially executing code before and after the call to the original function.
Helper function used in the wrapping of an existing javascript function.

Functions

includeOnce

Add a reference to the specified script file if one does not already exist in the HEAD of the current document.

This will effecitvely cause the script file to be loaded in the browser.

fileName(string): The URI of the file.

Returns

trueThe reference exists or was added.

includeScript

xajax.js.includeScript = function(fileName)

Adds a SCRIPT tag referencing the specified file.  This effectively causes the script to be loaded in the browser.

fileName(string): The URI of the file.

Returns

trueThe reference was added.

removeScript

xajax.js.removeScript = function(fileName,
unload)

Locates a SCRIPT tag in the HEAD of the document which references the specified file and removes it.

fileName(string): The URI of the script file.
unload(function, optional): The function to call just before the file reference is removed.  This can be used to clean up objects that reference code from that script file.

Returns

trueThe script was not found or was removed.

sleep

xajax.js.sleep = function(args)

Causes the processing of items in the queue to be delayed for the specified amount of time.  This is an asynchronous operation, therefore, other operations will be given an opportunity to execute during this delay.

args(object): The response command containing the following parameters.
  • args.property: The number of 10ths of a second to sleep.

Returns

trueThe sleep operation completed.
falseThe sleep time has not yet expired, continue sleeping.

confirmCommands

xajax.js.confirmCommands = function(msg,
numberOfCommands)

Prompt the user with the specified text, if the user responds by clicking cancel, then skip the specified number of commands in the response command queue.  If the user clicks Ok, the command processing resumes normal operation.

msg(string): The message to display to the user.
numberOfCommands(integer): The number of commands to skip if the user clicks Cancel.

Returns

trueThe operation completed successfully.

execute

xajax.js.execute = function(args)

Execute the specified string of javascript code, using the current script context.

argsThe response command object containing the following:
  • args.data: (string): The javascript to be evaluated.
  • args.context: (object): The javascript object that to be referenced as ‘this’ in the script.

Returns

unknownA value set by the script using ‘returnValue = ‘
trueIf the script does not set a returnValue.

waitFor

xajax.js.waitFor = function(args)

Test for the specified condition, using the current script context; if the result is false, sleep for 1/10th of a second and try again.

argsThe response command object containing the following:
  • args.data: (string): The javascript to evaluate.
  • args.property: (integer): The number of 1/10ths of a second to wait before giving up.
  • args.context: (object): The current script context object which is accessable in the javascript being evaulated via the ‘this’ keyword.

Returns

falseThe condition evaulates to false and the sleep time has not expired.
trueThe condition evaluates to true or the sleep time has expired.

call

xajax.js.call = function(args)

Call a javascript function with a series of parameters using the current script context.

argsThe response command object containing the following:
  • args.data: (array): The parameters to pass to the function.
  • args.func: (string): The name of the function to call.
  • args.context: (object): The current script context object which is accessable in the function name via the ‘this’ keyword.

Returns

trueThe call completed successfully.

setFunction

xajax.js.setFunction = function(args)

Constructs the specified function using the specified javascript as the body of the function.

argsThe response command object which contains the following:
  • args.func: (string): The name of the function to construct.
  • args.data: (string): The script that will be the function body.
  • args.context: (object): The current script context object which is accessable in the script name via the ‘this’ keyword.

Returns

trueThe function was constructed successfully.

wrapFunction

xajax.js.wrapFunction = function(args)

Construct a javascript function which will call the original function with the same name, potentially executing code before and after the call to the original function.

args(object): The response command object which will contain the following:
  • args.func: (string): The name of the function to be wrapped.
  • args.property: (string): List of parameters used when calling the function.
  • args.data: (array): The portions of code to be called before, after or even between calls to the original function.
  • args.context: (object): The current script context object which is accessable in the function name and body via the ‘this’ keyword.

Returns

trueThe wrapper function was constructed successfully.

makeWrapper

xajax.js.makeWrapper = function(origFun,
args,
codeBlocks,
returnVariable,
context)

Helper function used in the wrapping of an existing javascript function.

origFun(string): The name of the original function.
args(string): The list of parameters used when calling the function.
codeBlocks(array): Array of strings of javascript code to be executed before, after and perhaps between calls to the original function.
returnVariable(string): The name of the variable used to retain the return value from the call to the original function.
context(object): The current script context object which is accessable in the function name and body via the ‘this’ keyword.

Returns

objectThe complete wrapper function.

xajax.dom

Summary
Assign an element’s attribute to the specified value.
Append the specified value to an element’s attribute.
Prepend the specified value to an element’s attribute.
Search and replace the specified text.
Delete an element.
Create a new element and append it to the specified parent element.
Insert a new element before the specified element.
Insert a new element after the specified element.
Assign a value to a named member of the current script context object.
Appends a value to a named member of the current script context object.
Prepend a value to a named member of the current script context object.

Functions

assign

xajax.dom.assign = function(element,
property,
data)

Assign an element’s attribute to the specified value.

element(object): The HTML element to effect.
property(string): The name of the attribute to set.
data(string): The new value to be applied.

Returns

trueThe operation completed successfully.

append

xajax.dom.append = function(element,
property,
data)

Append the specified value to an element’s attribute.

element(object): The HTML element to effect.
property(string): The name of the attribute to append to.
data(string): The new value to be appended.

Returns

trueThe operation completed successfully.

prepend

xajax.dom.prepend = function(element,
property,
data)

Prepend the specified value to an element’s attribute.

element(object): The HTML element to effect.
property(string): The name of the attribute.
data(string): The new value to be prepended.

Returns

trueThe operation completed successfully.

replace

xajax.dom.replace = function(element,
sAttribute,
aData)

Search and replace the specified text.

element(string or object): The name of, or the element itself which is to be modified.
sAttribute(string): The name of the attribute to be set.
aData(array): The search text and replacement text.

Returns

trueThe operation completed successfully.

remove

xajax.dom.remove = function(element)

Delete an element.

element(string or object): The name of, or the element itself which will be deleted.

Returns

trueThe operation completed successfully.

create

xajax.dom.create = function(objParent,
sTag,
sId)

Create a new element and append it to the specified parent element.

objParent(string or object): The name of, or the element itself which will contain the new element.
sTag(string): The tag name for the new element.
sId(string): The value to be assigned to the id attribute of the new element.

Returns

trueThe operation completed successfully.

insert

xajax.dom.insert = function(objSibling,
sTag,
sId)

Insert a new element before the specified element.

objSibling(string or object): The name of, or the element itself that will be used as the reference point for insertion.
sTag(string): The tag name for the new element.
sId(string): The value that will be assigned to the new element’s id attribute.

Returns

trueThe operation completed successfully.

insertAfter

xajax.dom.insertAfter = function(objSibling,
sTag,
sId)

Insert a new element after the specified element.

objSibling(string or object): The name of, or the element itself that will be used as the reference point for insertion.
sTag(string): The tag name for the new element.
sId(string): The value that will be assigned to the new element’s id attribute.

Returns

trueThe operation completed successfully.

contextAssign

xajax.dom.contextAssign = function(args)

Assign a value to a named member of the current script context object.

args(object): The response command object which will contain the following:
  • args.property: (string): The name of the member to assign.
  • args.data: (string or object): The value to assign to the member.
  • args.context: (object): The current script context object which is accessable via the ‘this’ keyword.

Returns

trueThe operation completed successfully.

contextAppend

xajax.dom.contextAppend = function(args)

Appends a value to a named member of the current script context object.

args(object): The response command object which will contain the following:
  • args.property: (string): The name of the member to append to.
  • args.data: (string or object): The value to append to the member.
  • args.context: (object): The current script context object which is accessable via the ‘this’ keyword.

Returns

trueThe operation completed successfully.

contextPrepend

xajax.dom.contextPrepend = function(args)

Prepend a value to a named member of the current script context object.

args(object): The response command object which will contain the following:
  • args.property: (string): The name of the member to prepend to.
  • args.data: (string or object): The value to prepend to the member.
  • args.context: (object): The current script context object which is accessable via the ‘this’ keyword.

Returns

trueThe operation completed successfully.

xajax.css

Summary
Add a LINK reference to the specified .css file if it does not already exist in the HEAD of the current document.
Locate and remove a LINK reference from the current document’s HEAD.
Attempt to detect when all .css files have been loaded once they are referenced by a LINK tag in the HEAD of the current document.

Functions

add

xajax.css.add = function(filename)

Add a LINK reference to the specified .css file if it does not already exist in the HEAD of the current document.

filename(string): The URI of the .css file to reference.

Returns

trueThe operation completed successfully.

remove

xajax.css.remove = function(filename)

Locate and remove a LINK reference from the current document’s HEAD.

filename(string): The URI of the .css file.

Returns

trueThe operation completed successfully.

waitForCSS

xajax.css.waitForCSS = function(args)

Attempt to detect when all .css files have been loaded once they are referenced by a LINK tag in the HEAD of the current document.

args(object): The response command object which will contain the following:
  • args.property - (integer): The number of 1/10ths of a second to wait before giving up.

Returns

trueThe .css files appear to be loaded.
falseThe .css files do not appear to be loaded and the timeout has not expired.

xajax. forms

Summary
Create and return a form input element with the specified parameters.
Create a new input element under the specified parent.
Insert a new input element before the specified element.
Insert a new input element after the specified element.

Functions

getInput

Create and return a form input element with the specified parameters.

type(string): The type of input element desired.
name(string): The value to be assigned to the name attribute.
id(string): The value to be assigned to the id attribute.

Returns

objectThe new input element.

createInput

xajax.forms.createInput = function(objParent,
sType,
sName,
sId)

Create a new input element under the specified parent.

objParent(string or object): The name of, or the element itself that will be used as the reference for the insertion.
sType(string): The value to be assigned to the type attribute.
sName(string): The value to be assigned to the name attribute.
sId(string): The value to be assigned to the id attribute.

Returns

trueThe operation completed successfully.

insertInput

xajax.forms.insertInput = function(objSibling,
sType,
sName,
sId)

Insert a new input element before the specified element.

objSibling(string or object): The name of, or the element itself that will be used as the reference for the insertion.
sType(string): The value to be assigned to the type attribute.
sName(string): The value to be assigned to the name attribute.
sId(string): The value to be assigned to the id attribute.

Returns

trueThe operation completed successfully.

insertInputAfter

xajax.forms.insertInputAfter = function(objSibling,
sType,
sName,
sId)

Insert a new input element after the specified element.

objSibling(string or object): The name of, or the element itself that will be used as the reference for the insertion.
sType(string): The value to be assigned to the type attribute.
sName(string): The value to be assigned to the name attribute.
sId(string): The value to be assigned to the id attribute.

Returns

trueThe operation completed successfully.

xajax. events

Summary
Set an event handler.
Add an event handler to the specified element.
Remove an event handler from an element.

Functions

setEvent

xajax.events.setEvent = function(element,
sEvent,
code)

Set an event handler.

element(string or object): The name of, or the object itself.
event(string): The name of the event to set.
code(string): The javascript code to be assigned to this event.

Returns

trueThe operation completed successfully.

addHandler

Add an event handler to the specified element.

element(string or object): The name of, or the element itself which will have the event handler assigned.
sEvent(string): The name of the event.
fun(string): The function to be called.

Returns

trueThe operation completed successfully.

removeHandler

Remove an event handler from an element.

element(string or object): The name of, or the element itself which will have the event handler removed.
event(string): The name of the event for which this handler is associated.
funThe function to be removed.

Returns

trueThe operation completed successfully.

xajax. callback

Summary
Create a blank callback object.
Create a timer to fire an event in the future.
Clear a callback timer for the specified function.
Execute a callback event.

Functions

create

xajax.callback.create = function()

Create a blank callback object.  Two optional arguments let you set the delay time for the onResponseDelay and onExpiration events.

Returns

objectThe callback object.

setupTimer

xajax.callback.setupTimer = function(iDelay)

Create a timer to fire an event in the future.  This will be used fire the onRequestDelay and onExpiration events.

iDelay(integer): The amount of time in milliseconds to delay.

Returns

objectA callback timer object.

clearTimer

xajax.callback.clearTimer = function(oCallback,
sFunction)

Clear a callback timer for the specified function.

oCallback(object): The callback object (or objects) that contain the specified function timer to be cleared.
sFunction(string): The name of the function associated with the timer to be cleared.

execute

xajax.callback.execute = function(oCallback,
sFunction,
args)

Execute a callback event.

oCallback(object): The callback object (or objects) which contain the event handlers to be executed.
sFunction(string): The name of the event to be triggered.
args(object): The request object for this request.

xajax. callback. global

The global callback object which is active for every request.

xajax

Summary
The response queue that holds response commands, once received from the server, until they are processed.
This array contains a list of codes which will be returned from the server upon successful completion of the server portion of the request.
This array contains a list of status codes returned by the server to indicate that the request failed for some reason.
An array of status codes returned from the server to indicate a request for redirect to another URL.
The array of command handlers that are currently available.
Initialize a request object, populating default settings, where call specific settings are not already provided.
Processes request specific parameters and generates the temporary variables needed by xajax to initiate and process the request.
Prepares the XMLHttpRequest object for this xajax request.
Initiates a call to the server.
Create a request object and submit the request using the specified request type; all request parameters should be finalized by this point.
This function is used internally by xajax to initiate a request to the server.
Abort the request.
Process the response.
This function attempts to determine, based on the content type of the reponse, what processor should be used for handling the response data.
Take the parameters passed in the command of the XML response and convert them to parameters of the args object.
Parses the child nodes of the command of the response XML.
Perform a lookup on the command specified by the response command object passed in the first parameter.
Called by the response command queue processor when all commands have been processed.
Shortcut to xajax.tools.$.
<