jQuery in Action
278
CHAPTER 9
Prominent, powerful, and practical plugins
target
(String|Object|Element) Specifies a DOM element or elements to receive the
response body as content. This can be a string depicting a jQuery selector, a jQuery
wrapper containing the target elements, or a direct element reference. If omitted, no
element receives the response body.
response body as content. This can be a string depicting a jQuery selector, a jQuery
wrapper containing the target elements, or a direct element reference. If omitted, no
element receives the response body.
beforeSubmit
(Function) Specifies a callback function invoked prior to initiating the Ajax request.
This callback is useful for performing any pre-processing operations including the vali-
dation of form data. If this callback returns the value false, the form submission
dation of form data. If this callback returns the value false, the form submission
is cancelled.
This callback is passed the following three parameters:
This callback is passed the following three parameters:
An array of the data values passed to the request as parameters. This is an array of
objects; each contains two properties, name and value, containing the name and
value of a request parameter.
objects; each contains two properties, name and value, containing the name and
value of a request parameter.
The jQuery matched set that the command was applied to.
The options object that was passed to the command.
If omitted, no pre-processing callback is invoked.
success
(Function) Specifies a callback invoked after the request has completed and returned
as response with successful status.
This callback is passed the following three parameters:
as response with successful status.
This callback is passed the following three parameters:
The response body as interpreted according to the dataType option.
A string containing success.
The jQuery matched set that the command was applied to.
If omitted, no success callback is invoked.
If this is the only option to be specified, this function can be passed directly to the
command in place of the options hash.
Note that no provisions have been made for a callback upon error conditions.
If this is the only option to be specified, this function can be passed directly to the
command in place of the options hash.
Note that no provisions have been made for a callback upon error conditions.
clearForm
(Boolean) If specified and true, the form is cleared after a successful submission.
See clearForm() for semantics.
See clearForm() for semantics.
resetForm
(Boolean) If specified and true, the form is reset after a successful submission. See
resetForm()
resetForm()
for semantics.
semantic
(Boolean) If specified and true, the form parameters are arranged in semantic order.
The only difference this makes is in the location of the parameters submitted for input
element of type image when the form is submitted by clicking that element. Because
there's overhead associated with this processing, this option should be enabled only if
parameter order is important to the server-side processing and image input elements
are used in the form.
The only difference this makes is in the location of the parameters submitted for input
element of type image when the form is submitted by clicking that element. Because
there's overhead associated with this processing, this option should be enabled only if
parameter order is important to the server-side processing and image input elements
are used in the form.
other options
Any options that are available for the core jQuery $.ajax() function, as described in
table 8.2, can be specified and will pass through to the lower-level call.
table 8.2, can be specified and will pass through to the lower-level call.
Table 9.1 The optional properties for the
ajaxSubmit()
command, listed according to likelihood
of use (continued)
Name
Description