JQuery ajax understanding and jqueryajax understanding
To understand jQuery ajax:
1. ajax (Asynchronous JavaScript and XML) is a technology that exchanges data with the server and updates some webpages without reloading the entire page, it is of great help to improve website performance and user experience.
2. Easy-to-use high-level implementation: $. get, $. post; complete implementation: $. ajax
1 $. ajax ({2 url: "url", // call Path 3 type: "post", // Request Method 4 async: false, // synchronous request, default: true, if this parameter is set to false, other operations must be performed before the 5 cache: false, // cache is executed. The default value is true 6 contentType: "application/x-www-form-urlencoded ", // Content Encoding type when sending information to the server. If the encoding type has special requirements, it must be changed, for example, json format 7 data: {foo: ["bar1 ", "bar2"]}, // data sent to the server 8 dataType: "json", // type of data returned by the server (xml, html, script, json, jsonp, text) 9 traditional: true, // If You Want to serialize data in a traditional way, set it True. When processing array data, you can use 10 success: function (data) {// data for the returned data 11 // callback function 12 after success}, 13 error: function (data) {14 // callback function 15}, 16 beforeSend: function (data) {17 // called before sending the request, and input an XMLHttpRequest as parameter 18} 19 })
$. Get, $. post is similar and has few parameters. It is a simplified version of $. ajax.