jQuery in Action

The Form Plugin
277
to the method, or we can allow the request to default from the settings on the tar-
get form.
Let's look at its syntax.
The
options
parameter can be used to specify exactly how the request is to be made.
The optional properties are described in table 9.1, and all properties have defaults
designed to make it easy to generate requests with the minimum of fuss and bother.
It's common to call this method with no options and let all the defaults apply.
Command syntax: ajaxSubmit
ajaxSubmit(options)
Generates an Ajax request using the successful controls within the form in the wrapped set.
The options parameter can be used to specify optional settings, or these settings can be
defaulted as described in the following table.
Parameters
options
(Object|Function) An optional object hash containing properties as described in
table 9.1. If the only desired option is a success callback, it can be passed in
place of the options hash.
Returns
The wrapped set.
Table 9.1 The optional properties for the
ajaxSubmit()
command, listed according to likelihood
of use
Name
Description
url
(String) The URL to which the Ajax request will be submitted. If omitted, the URL will
be taken from the action attribute of the target form.
type
(String) The HTTP method to use when submitting the request, such as GET or POST. If
omitted, the value specified by the target form's method attribute is used. If not spec-
ified and the form has no method attribute, GET is used.
dataType
(String) The expected data type of the response, which determines how the response
body will be post-processed. If specified, it must be one of the following:
xml
--Treated as XML data. Any success callback will be passed the response-
XML
document.
json
--Treated as a JSON construct. The JSON is evaluated, and the result is
passed to any success callback.
script
--Treated as JavaScript. The script will be evaluated in the global context.
If omitted, no post-processing of the data (except as specified by other options such
as target) takes place.
continued on next page


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.