$.ajax({ url:'/', type:'get', beforeSend:function () { // 显示loading }, success:function (data) { // 处理数据 }, complete:function(){ // 隐藏loading } });