Ajax: You can update the page without refreshing the status, and implement asynchronous commit, which improves the user's experience.
1.load () function can be used with three parameters: URL (required parameter, URL address of request HTML file, parameter type string), date (optional, send key/value data, Parameter type Object), callback (optional, A successful or failed callback function that has a parameter type of function.
Html
<input type= "button" value= "Get Data asynchronously"/>
<div id= "box" ></div>
Jquery
$ (' input '). Click (function () {
$ (' #box '). Load (' test.html '); There is only one parameter URL in the function.
});
2) pass two parameter URL and data.
Jquery
$ (' input '). Click (function () {
$ (' #box '). Load (' test.php ', {
URL: ' Ycku '
}); There are only two parameter URLs in the function and the data parameter passed in Ycku.
});
3) pass three parameter URLs and data and callback functions.
$ (' input '). Click (function () {
$ (' #box '). Load (' test.php ', {
URL: ' Ycku '
}, function (response, status, XHR) {
Alert (' return value: ' + response + ', Status: ' + Status + ', Status: ' + Xhr.statustext ');
});
});
Jeasyui Production Planning-ajax Learning