jquery.form & jquery ajax 加载代理

$.ajaxLoad = function(p){
	bodyLoading.show({loadTitle:p.loadTitle,loadMsg:p.loadMsg});
	var complate = p.complete;
	var success = p.success;
	var error = p.error;
	var option = {
		success:function(d){
			if(success)success(d);
		},
		error:function(e){
			if(error)error(e);
		},
		complete:function(d){
			if(complate)complete(d);
			bodyLoading.resetHide();
		}
	};
	$.extend(p,option);
	$.ajax(p);
};

$.fn.ajaxLoad = function(p){
	bodyLoading.show();
	var complate = p.complete;
	var success = p.success;
	var error = p.error;
	var option = {
		method:"post",
		success:function(d){
			if(success)success(d);
		},
		error:function(e){
			if(error)error(e);
			bodyLoading.resetHide();
		},
		complete:function(d){
			if(complate)complete(d);
			bodyLoading.resetHide();
		}
	};
	$.extend(p,option);
	$(this).ajaxSubmit(p);
};
$.fn.submitLoad = function(p){
	var complate = p.complete;
	var success = p.success;
	var error = p.error;
	var beforeSubmit = p.beforeSubmit;
	var option = {
		method:"post",
		beforeSubmit:function(d){
			bodyLoading.show();
			if(beforeSubmit){
				return beforeSubmit(d);
			}
		},
		success:function(d){
			if(success)success(d);
		},
		error:function(e){
			if(error)error(e);
			bodyLoading.resetHide();
		},
		complete:function(d){
			if(complate)complete(d);
			bodyLoading.resetHide();
		}
	};
	$.extend(p,option);
	$(this).submit(function(){
		$(this).ajaxSubmit(p);
		return false;
	});
};

你可能感兴趣的:(jquery.form & jquery ajax 加载代理)