AJAX Molecule

From oWiki

Jump to: navigation, search

Contents


Preference Dialog

File:Ajax_pref.png

Attributes

type

string  ( r )
Type of this molecule, 'ajax'.

pref.name

string  ( r )
The scriptable name for this molecule. This name can be set using rename method dynamically.

pref.enableWhen

string  ( r, w )
Specifies the event that activates this molecule. Default is 'none'.

pref.url

string  ( r, w )
Specifies the target URL.

pref.type

string  ( r, w )
Specifies type of AJAX operation (GET or POST).

pref.withData

string/object  ( r, w )
Specifies an object or the name of an Object molecule that is to be used as the post data (query string) in the AJAX POST/GET operation. The object's attributes, key/value pairs, are automatically concatenated.

pref.isTriggerEvent

bool  ( r, w )
Specifies whether to send an event or execute a script when AJAX completes.

pref.eventName

string  ( r, w )
Specifies the custom event name that this molecule sends out when AJAX completes.

pref.isBroadcast

bool  ( r, w )
Specifies whether the event is sent to all droplets or a few selected droplets in a group.

pref.targets

array  ( r, w )
Specifies the list of names of droplets that the event is to be sent to when AJAX completes.

pref.scriptName

string  ( r, w )
Specifies javascript function name that will be executed when AJAX completes.


Methods

rename(n)

n: string

Rename this molecule.

clone()

Return: a molecule

Create a clone of this molecule.

attach(droplet)

droplet: a droplet object (e.g. app.box.droplet)

Attach this molecule to a droplet.

detach()

Remove this molecule from its droplet.

deleteMod()

Delete this molecule.

serialize()

Return: string

Serialize this molecule into its JSON representation.

open( url )

url: string

Start an ajax session to the given url.


Comments

The Script Molecule that receives AJAX events is given an input parameter, params, which is a javascript object with the following properties:

params.readyState

int  ( r )
The progress status of the AJAX process.

Value Description
1 The object has been created, but the send method has not been called.
2 The send method has been called. responseText is not available.
3 Some data has been received. responseText is not available.
4 All the data has been received. responseText is available.

params.status

int  ( r )
The HTTP status code.

params.responseText

string  ( r )
The returned data in plain text.

Personal tools