In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "what are the parameters of the ajax method in jquery". In the daily operation, I believe that many people have doubts about the parameters of the ajax method in jquery. The editor consulted all kinds of materials and sorted out the simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "what are the parameters of the ajax method in jquery?" Next, please follow the editor to study!
1.url:
Requires a parameter of type String (the default is the current page address) to send the requested address.
2.type:
A parameter of type String is required, and the request method (post or get) defaults to get. Note that other http request methods, such as put and delete, can also be used, but only some browsers support them.
3.timeout:
Requires a parameter of type Number to set the request timeout (in milliseconds). This setting overrides the global setting of the $.ajaxSetup () method.
4.async:
A parameter of type Boolean is required. The default setting is true. All requests are asynchronous requests. If you need to send a synchronization request, set this option to false. Note that the synchronization request locks the browser, and the user must wait for the request to complete before performing other actions.
5.cache:
A parameter of type Boolean is required. The default is true (when dataType is script, the default is false). Setting to false will not load the request information from the browser cache.
6.data:
Data sent to the server is required for parameters of type Object or String. If it is no longer a string, it is automatically converted to string format. The get request will be appended to the url. To prevent this automatic conversion, you can check the processData option. The object must be in key/value format, such as {foo1: "bar1", foo2: "bar2"} converted to & foo1=bar1&foo2=bar2. If it is an array, JQuery automatically corresponds to the same name for different values. For example, {foo: ["bar1", "bar2"]} is converted to & foo=bar1&foo=bar2.
7.dataType:
Requires a parameter of type String, the type of data expected to be returned by the server. If not specified, JQuery automatically returns responseXML or responseText based on the http package mime information and passes it as a callback function parameter. The available types are as follows:
Xml: returns the XML document, which can be processed with JQuery.
Html: returns plain text HTML information; the included script tag is executed when the DOM is inserted.
Script: returns plain text JavaScript code. The results are not automatically cached. Unless the cache parameter is set. Note that when a remote request is made (not under the same domain), all post requests will be converted to get requests.
Json: returns JSON data.
Jsonp:JSONP format. When calling a function in the form of SONP, for example, myurl?callback=?,JQuery will automatically replace the latter "?" Is the correct function name to execute the callback function.
Text: returns a plain text string.
8.beforeSend:
It is required to be a parameter of type Function. You can modify the function of the XMLHttpRequest object before sending the request, such as adding a custom HTTP header. If false is returned in beforeSend, you can cancel this ajax request. The XMLHttpRequest object is the only parameter.
Function (XMLHttpRequest) {
This; / / the options parameter passed when this ajax request is called
}
9.complete:
A parameter of type Function is required, and the callback function is called after the request is completed (called when the request succeeds or fails). Parameters: the XMLHttpRequest object and a string that describes the type of successful request.
Function (XMLHttpRequest, textStatus) {
This; / / the options parameter passed when this ajax request is called
}
At this point, the study of "what are the parameters of the ajax method in jquery" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.