VII.
: Ajax support
Common method:
$. Ajax (PROP) goes back to remote data through an Ajax request. Prop is a hash table that can transmit the following key/value types: .
(String) type: Data Transmission Method (get or post ).
(String) URL: the URL of the data request page
(String) data: the parameter string used to pass data. It is only applicable to the POST method.
(String) datatype: the format of the data to be returned (for example, "XML", "html", "script", or "JSON ")
(Boolean) ifmodified: returns a successful response only when the last request changes accordingly. The default value is false.
(Number) Timeout: Set the request time delay. For more information, see $. ajaxtimeout.
(Boolean) Global: whether to trigger Ajax global events for the current request. The default value is true.
(Function) error: the function triggered when the request fails.
(Function) Success: triggers a function when the request is successful.
(Function) Complete: the departure function after the request is complete.
Jquery Code And Description
$. Ajax ({URL: " Ajax.htm " ,
Success: Function (MSG ){
$ (Div " # " Pai.html (MSG );
}
});
Use the content returned by ajax.htm as the DIV content with ID.
$. Ajax ({URL: " Ajax. aspx " ,
Type: " Get " ,
Datatype: " Html " ,
Data: " Name = John & location = Boston " ,
Success: Function (MSG ){
$ ( " # " Pai.html (MSG );
}
});
Use the get method to pass Parameters to the Ajax. ASPX page and send the returned content to the object with ID.
$. Ajaxtimeout (time) Set Request End Time
$. Ajaxtime out (5000)
Other simplified methods:
$. Get (URL, Params, callback)The get method is used to pass parameters to the remote page. After the request completes the post-processing function, other parameters except the URL are randomly selected.!
$. Get ( " Ajax.htm " , Function (Data) {$ ( " # " Pai.html (data )}) $. Get ( " Ajax. asp " ,
{Name: " Young " , Age: " 25 " },
Function (Data) {alert ( " Data loaded: " + Data );}
)
$. Getifmodified (URL, Params, callback)The get method is used to pass parameters to the remote page. After the last request, if the data changes, the callback function is executed.
$. Getjson (URL, Params, callback)The get method is used to pass parameters to a remote JSON object, and the callback function is used after the request is completed.
$. Getscript (URL, callback)Load and run a remote Javascript file in get mode. The callback function after the request is completed.
$. Post (URL, Params, callback)Pass parameters to the remote page in post mode, and call back is the post-processing function after the request is completed.
Load (URL, Params, callback)Load a remote file, load the Dom on the page, and execute the callback function.
$ ( " # " ). Load ( " Ajax.htm " , Function () {Alert ( " Load is done " );});
smile XU Yu sends a request to the ajax.htm page, loads the returned result into the content with ID a, and then runs the callback function.
loadifmodified (URL, Params, callback) use the get method to send Parameters to the remote page. After the last request, if the data changes, the response will be loaded into the page Dom, run the callback function
ajaxstart (callback) when an Ajax request error occurs, the callback function is executed.
ajaxcomplete (callback) execute the callback function when the Ajax request is complete
ajaxerror (callback) execute the callback function when an Ajax request error occurs
ajaxstop (callback) call back is executed when an Ajax request is stopped.
ajaxsuccess (callback) execute the callback function when the Ajax request is successful
end : jquery plugin
with the extensive use of jquery, a large number of jquery plug-ins have emerged, such as thickbox, ifx, jquery-GoogleMap, etc. You can easily use these plug-ins by referencing these source files. Here I will briefly introduce some websites for your reference. These website headers provide a large number of demos, which are easy to use and can be quickly grasped if e is not good!
http://jquery.com/plugins official recommendations
http://interface.eyecon.ro/demos effect is superb, use more simple, you must have your favorite!
http://www.dyve.net/jquery/
http://bassistance.de/jquery-plugins