AJAX - The Complete Reference

(avery) #1

200 Part II: Applied Ajax^


Beyond the AjaxTCR Library


Clearly there are going to be a few angry readers who may have developed or are in love with
a library not mentioned in this section. Unfortunately, we can only address so much in a print
book, particularly with any major accuracy, but suffice to say there are many valuable libraries
to be explored by intrepid readers. We admittedly provide limited discussion of some of the
libraries because of the volatility of their syntax. Library project owners should expect to be
poorly covered if they significantly modify their code in a span of a few months. Even if this
were not the case, the aim is not to be definitive in the syntax discussion of said libraries
because they are likely being improved, but instead to give the flavor of the library, expose
readers to its syntax, and share any hard-earned insights we might have learned when using it.

Option Description Example(s)
serializeForm: form Automatically encodes the contents
of the form specified as a passed
JavaScript object or referenced
via a DOM id or name. A default
encoding of x-www-form-
urlencoded will be used unless
the requestContentType
attribute is set.

serializeForm : ratingForm

showProgress :
Boolean

Setting this property to true
indicates that the progress event
will fire.

showProgress: true

statusIndicator :
statusObject

The property should be set to an
object that contains visual display
information for indicating status. At
this point, it supports an object with
a single property progress set to an
object containing type that can be
either image or text; imageSrc
is the URL of the image to use in
the case type is set to image;
and text is a string to use in the
case the type is set to text. A
target property is set to the DOM
id reference of the place the status
should be displayed.

statusIndicator : {progress :
{type:"image",
imgSrc: "spinner.gif",
target: "responseOutput"}}

statusIndicator : {progress :
{type:"text",
text: "I’m loading as fast as
I Can!",
target: "someDiv"}}

useRaw: Boolean By default this is set to true and is
consulted when outputTarget is
set. If set to false, the response’s
payload will not be directly put
into the outputTarget, forcing
the user to manually per form any
decode and placement.

userRaw : true

TABLE 5-3 Options for sendRequest() (continued)
Free download pdf