标准的ajax上传

$.ajax({
                    async:false,
                    cache:false,
                    url:'/admin/film/save',
                    type:'post',
                    dataType:"json",
                    data: params,
                    success:function (result) {
                        if(result.success){
                            resetValue();
                            layer.msg("系统提示,添加成功", { icon: 6 });
                        }else{
                            layer.msg("系统提示,添加失败,请联系管理员", { icon: 5});
                        }
                    },
                    error:function (XMLHttpRequest, textStatus) {
                        layer.alert("状态码: "+XMLHttpRequest.status +" 错误信息: "+ textStatus);
                    }
                });

 在ajax提交中,加入一个layer的加载的弹出层,

beforeSend: function(){
                //index = top.layer.msg('数据查询中,请稍候',{icon: 16,time:false,shade:0.8});
                index = layer.load(0, {shade: false});
            },

然后在success里面加个关闭就行了

top.layer.close(index);

 post的提交方法。

$.post($('body').attr('plmsctx')+"/voyageInformation/queryIsCreated",{
        voyageId:voyageId
    },function (result) {
  ......  
},"json")
原文地址:https://www.cnblogs.com/fuckingPangzi/p/9938676.html