$(function () {

	/*$('form input[type=button]').click(function() {
$.ajax({
type:'POST',
//url:'http://www.google.com/user.php',
url:'user1.php',
data:$('form').serialize(),
success: function(response,status,xhr){
$("#box").html(response);
},
error: function(xhr,errorText,errortype){
//alert('错误!!');
//alert(errorText+':'+errortype);
alert(xhr.status+':'+xhr.statusText);
}
//timeout:3000
//global:false
}); });
$(document).ajaxStart(function() {
$('.loading').show();
}).ajaxStop(function() {
$('.loading').hide();
$.post('user1.php').error(function(xhr,errorText,errortype){
//alert('错误');
//alert(errorText+':'+errortype);
alert(xhr.status+':'+xhr.statusText);
})
$.post('user1.php'); });
$(document).ajaxError(function(event, jqXHR, ajaxOptions, thrownError) {
// alert('错误');
//alert(event.type);
//alert(event.target);
/*for(var i in event){
document.write(i+'<br />');
}*/ /*for(var i in ajaxOptions){
document.write(i+'<br />');
}
//alert(ajaxOptions.url);
//alert(ajaxOptions.type);
alert(thrownError);
}); $(document).ajaxStart(function() {
$('.loading').show();
});
*/ $('form input[type=button]').click(function() {
$.post('user1.php',$('form').serialize()).success(function(){
alert('请求成功后');
}).complete(function(){
alert('请求完成后');
}).error(function(){
alert('请求失败后');
});
});
/*$(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
alert('发送请求之前执行');
}).ajaxComplete(function(event, XMLHttpRequest, ajaxOptions) {
alert('请求完成后,不管是否有错误,都会执行');
}).ajaxSuccess(function(event, XMLHttpRequest, ajaxOptions) {
alert('请求成功后');
}).ajaxError(function(event, jqXHR, ajaxOptions, thrownError) {
alert('请求失败后');
});*/
});

  

04-13 16:45