jquery ajax的请求格式
$.ajax({
type : 'post',//post或者get
url : url,
async : false,//是否异步提交 默认为true
global : false,//阻止ajax全局属性生效,比如下面的ajaxStart和ajaxStop
data : {
"id" : id,
"name" : name,
"title" : title
},//json格式
//data : 'id='+$('#id').val(),//字符串格式
dataType : 'html', //json
success : function(msg){
//数据处理
},
error : function(msg){
console.log(msg);//输出报错信息
}
});
ajax请求发起和完成时调用的方法,ajax请求发起时,显示遮罩层,请求完成后,关闭遮罩层
<div id="ajaxShowBg" style="width: 100%; height: 100%; position: fixed; z-index: 1988; top: 0; left: 0; overflow: hidden; display: none;">
<div style