一 jQuery AJAX
$.ajax({
type: "POST",
url: '/someUrl',
data: {"id":id},
dataType:'json',
cache: false,
success: function(data){
$.each(data.list, function(i, list){
nextPage(${page.currentPage});
});
}
});
二 Vue axios
axios.get('/someUrl')
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
axios({
method: 'post',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
url: '/someUrl',
data: {},
transformRequest: [function (data) {
}]
}).then(function (response) {
});
三 Angular1.5.5
3.1 get請求(通用方法)
$http({
method: 'GET',
url: '/someUrl'
}).success(function (response) {
// this callback will be called asynchronously
// when the response is available
}).error(function (response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
3.2 get請求(簡寫方法)
$http.get('/someUrl', config).success(function (response) {
// this callback will be called asynchronously
// when the response is available
}).error(function (response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
四 Angular1.6.3
4.1 get請求(通用方法)
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});
4.2 get請求(簡寫方法)
$http.get('/someUrl').then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
// called asynchronously if an error occurs
// or server returns response with an error status.
});