
jquery的ajax请求的主要参数
beforeSend:发送ajax请求之前
success:发送ajax请求成功
error:发送ajax请求错误,通常是网络失去连接、服务器出错、后台方法错误等造成的
代码:
$(function()
{
$.ajax(
{
url:location.href,
dataType:'json',
type:'post',
data:{action:'_yundanran-all-cat'},
beforeSend:function()
{
console.log('beforeSend');
},
success:function()
{
console.log('success');
},
error:function()
{
console.log('error');
},
complete:function()
{
console.log('complete');
}
});
});