Compared with the tedious js asynchronous object, ajax object structure jq clearer
A: ajax Object Description
ajax (Asynchronous JavaScript and XML), asynchronous xml and js objects, primarily for global basis does not refresh the page, partial page updates, and more for form submission, search update
jq ajax object in the format:
$.ajax({ // some code... })
ajax js of objects in this little repeat
Two: all types of property
A complete ajax objects should have at least four attributes: type, url, data, success
1.type when the transmission request is ajax format used, the value of a string type uppercase POST or GET
type: "GET",
2.url This is the address of the file read requests can be online, it can also be local. If locally, you need to enter a relative path and make sure the server is turned!
Online api to node example:
url: url "https://cnodejs.org/api/v1/topics", //: file path
3.seccess This operation is successfully transmitted after ajax request, followed by the callback parameter is a function of the result, the result means that the data received
success: function(result) { console.log (result) // result means a request data transmission received successfully },
This request is sent after 4.data incoming data
data: { // Here are some of the settings of the received data
},
Generally speaking, there are more than four properties would be able to complete the basic interactions
the above.