1. Ajax
Ajax请求:
$.ajax({
url: 'myPage.php',
success: function(response) {
alert(response);
},
error: function(xhr) {
alert('Error! Status = ' + xhr.status);
}
});
根据Ajax请求结果更新元素:
function updateStatus() {
$.ajax({
url: 'getStatus.php',
success: function(response) {
// update status element
$('#status').html(response);
}
});
}
从Ajax调用返回服务器Response
//...
getUrlStatus('getStatus.php', function(status) {
alert(status);
});
// ...
function getUrlStatus(url, callback) {
$.ajax({
url: url,
complete: function(xhr) {
callback(xhr.status);
}
});
}
转载于:https://www.cnblogs.com/MCNCU/archive/2010/08/03/1791575.html
5888




被折叠的 条评论
为什么被折叠?



