}
You can specify XML, script, HTML, JSON as its data type, you can set up processing functions for Beforesend, error, sucess, complete, and many other parameters can be customized to completely define the user's Ajax experience. In the following example, we use Ajax () to invoke an XML document:
Copy Code code as follows:
$.ajax ({
URL: ' Doc.xml ',
Type: ' Get ',
DataType: ' xml ',
timeout:1000,
Error:function ()
the processing function for Beforesend, error, sucess, complete and other states, and many other parameters can also be customized to completely define the user's Ajax experience. In the following example, we use Ajax () to invoke an XML document:The code is as follows: $.ajax ({url: ' doc.xml ', type: ' GET ', DataType: ' xml ', timeout:1000, Error:function () {Alert (' Error loading XML document '); },
, etc ... this;//the options for this Ajax reques T} function (data, textstatus) {//data could be xmldoc, jsonobj, HTML, text, etc ... this;//the options for this Ajax re Quest}You can specify XML, script, HTML, JSON as its data type, you can set the processing function for Beforesend, error, sucess, complete and other states, and many other parameters can also be customized to completely define the user's Ajax experience. In the following example, we
xmldoc, jsonobj, html, text, etc ... this;//the options for this Aja X request}
You can specify xml, script, html, JSON as its data type, you can set the processing function for beforesend, error, sucess, complete and other states, and many other parameters can also be customized to completely define the User's Ajax Experience. In the following example, we use Ajax () to invoke an XML document:Copy CodeThe code is as Follows:$.ajax ({Url: '
xmldoc, jsonobj, HTML, text, etc ... this;//the options for this AJA X Request}
You can specify XML, script, HTML, JSON as its data type, you can set the processing function for Beforesend, error, sucess, complete and other states, and many other parameters can also be customized to completely define the user's Ajax experience. In the following example, we use Ajax () to invoke an XML document:Copy CodeThe code is as follows:$.ajax ({URL: '
set the processing function for Beforesend, error, sucess, complete and other states, and many other parameters can also be customized to completely define the user's Ajax experience. In the following example, we use Ajax () to invoke an XML document:Copy the Code code as follows:$.ajax ({URL: ' Doc.xml ',Type: ' GET ',DataType: ' xml ',timeout:1000,Error:function () {Alert (' Error loading XML document ')
is added, and the type is the data type of the request, which can be html, xml, json, and Other types. If we set this parameter to json, the returned format is in json format. If no value is set, it is equal to $. get () returns the same format as a string.The Code is as follows: $. post ("data. php", $ ("# firstName. val ()"), function (data ){
$ ("# PostResponse" pai.html (data. name );
}, "Json" // sets the type of data to be retrieved, so the obtained data format is json
);
3, $. ajax (opit
(), next () or XPath, and other methods to find the node,There is no difference between manipulating HTML objects with jquery}});Learn more about AJAX eventsSome of the methods discussed earlier have their own event handling mechanism, which can only be described as local functions from the overall page. jquery provides the definition of an AJAX global function
(), next () or XPath, and other methods to find the node,There is no difference between manipulating HTML objects with jquery}});Learn more about AJAX eventsSome of the methods discussed earlier have their own event handling mechanism, which can only be described as local functions from the overall page. jquery provides the definition of an AJAX global function
, sucess, complete and other states, and many other parameters can also be customized to completely define the user's Ajax experience. In the following example, we use Ajax () to invoke an XML document:Copy CodeThe code is as follows:$.ajax ({URL: ' Doc.xml ',Type: ' GET ',DataType: ' xml ',timeout:1000,Error:function () {Alert (' Error loading XML document ');},Success:function (XML) {alert (XML);Here XML is the
document:The code is as follows: $.ajax ({URL: ' Doc.xml ',Type: ' GET ',DataType: ' xml ',timeout:1000,Error:function () {Alert (' Error loading XML document ');},Success:function (XML) {alert (XML); Here XML is the jquery object of XML, you can use Find (), next () or XPath, and other methods to find the node, and the use of jquery to manipulate the HTML objec
',
6 success:
CallBack,
7 Error:
function
(er) { C11>8
backerr (er);}
9 });
Thu, $.getjson (Url,[data],[callback])Description: The $.getjson (Url,[data],[callback]) function does not have a type parameter, the JSON type is returned, and no conversion is required.1 $.getjson ("Dep.do?p
data, returns the statusfunction (data, textstatus) {Data could be xmldoc, jsonobj, HTML, text, etc ...ThisThe options for this AJAX request}You can specify XML, script, HTML, JSON as its data type, you can set the processing function for Beforesend, error, sucess, complete and other states, and many other parameters can also be customized to completely define the user's Ajax experience. In the following example, we use Ajax () to invoke an XML docum
format is in json format. If no value is set, it is equal to $. get () returns the same format as a string.Copy the Code as follows:$. Post ("data. php", $ ("# firstName. val ()"), function (data ){$ ("# PostResponse" pai.html (data. name );}, "Json" // sets the type of data to be retrieved, so the obtained data format is json);3, $. ajax (opiton): $. Ajax () is a powerful function that provides many precise control over ajax. For details, see relevant materials.Copy the Code as follows:$. Ajax
',DataType: ' xml ',timeout:1000,Error:function () {Alert (' Error loading XML document ');},Success:function (XML) {alert (XML);Here XML is the jquery object of XML, you can use Find (), next () or XPath, and other methods to find the node,There is no difference between manipulating HTML objects with jquery}});Learn more about AJAX eventsSome of the methods dis
data format is of JSON type);
Three, $.ajax (Opiton)
Description: $.ajax () This function is powerful, you can do a lot of precise control of Ajax, you need to specify the relevant information to refer to$.ajax ({url: "ajax/ajax_selectpictype.aspx", Data:{full: "Fu"},type: "POST", DataType: ' JSON ', success:callback,error : function (er) {backerr (er);}});
IV, $.getjson (Url,[data],[callback])
$.
When jquery Ajax sends a request to the server, the server has an exception, such as: 400, 403, 404, 500 and other exceptions, the server will be abnormal response to the client, the AJAX can get exception information and processing, but at this time we generally jump to the exception code corresponding to the exception page, Show and deal with the anomaly.First, send an AJAX request:$.ajax ({Type: ' POST ',Url:url,Data:data,Success:success,Datatype:d
can be html, xml, json, and Other types. If we set this parameter to json, the returned format is in json format. If no value is set, it is equal to $. get () returns the same format as a string.
The Code is as follows:
$. Post ("data. php", $ ("# firstName. val ()"), function (data ){
$ ("# PostResponse" pai.html (data. name );
}, "Json" // sets the type of data to be retrieved, so the obtained data format is json
);
3, $. ajax (opiton)
: $. Ajax () is a powerful function that provides many
files.Speed: Average upload rate kb/sIntroduction to related functionsIn the above example, Uploadifyupload and uploadifyclearqueue two functions have been used, in addition to several functions:Uploadifysettings: You can dynamically modify the key values described above, such as the following code$ (' #uploadify '). Uploadifysettings (' folder ', ' JS ');If the Upload button event is written as follows, the file will be uploaded to the directory defined in the UploadifysettingsUploadifycancel:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.