AJAX - The Complete Reference

(avery) #1

618 Part IV: Appendixes


Option

Description

Default

Example

transport : "xhr" | "iframe" | "script" | "image"

Transport to make the request with. By default, this will be XHR though you can change it on a per request basis. The global transport can be set with

setDefault("DEFAULT_XHR_

TRANSPORT_VALUE",

value

)
, where

value

is one of the defined strings. The

transport choice may change a request depending on the capabilities of the transport indicated. For example, image and script transports will not accept a POST request and will convert it into a GET if possible.

"xhr" transport : "script"

transportIndicator : Boolean

Indicates if Ajax-indicating headers such as X-Requested-By: XHR

should be included.

Normally defined by value

AjaxTCR.comm.

DEFAULT_TRANSPORT_INDICATOR

.

Setting as an option affects only the request made; use the general getter/setter AjaxTCR.comm.setDefault(

"DEFAULT_

TRANSPORT_INDICATOR

", false);

to

change it for all requests.

true transportIndicator : false

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 you to manually perform any decode and placement.

true useRaw : false

username: string

Used to specify the username for HTTP authentication challenges issued to a request. Only usable with an XHR transport.

"" username: "koenig"

userVars : string | number | Boolean | array | object

Value attached to the request/response object that may contain any form of user-defined data.

undefined userVars : {

numDogs : 2, dogNames ["Angus", "Tucker"]
}userVars : "I love JavaScript"

TABLE

C-2

Options Object Properties for Making Requests (

continued

)

http://www.ebooks.org.in

Free download pdf