$.ajaxSetup({dataType:'json'});
$.ajaxPrefilter(function(ajaxOptions){
	// console.log(arguments);
	if (!ajaxOptions.skipProtect) {
		ajaxOptions.protectId = ajaxProtect.start();
	};
})
$(document).ajaxComplete(function(event, XMLHttpRequest, ajaxOptions){
	ajaxProtect.stop(ajaxOptions.protectId);
	if($.isFunction(ajaxOptions.Success) || $.isFunction(ajaxOptions.Error)){
		var json;
		try{
			json = $.parseJSON(XMLHttpRequest.responseText)
		}catch(e){
			if ($.isFunction(ajaxOptions.Error)) {
				ajaxOptions.Error.call(this,'parse error','error',ajaxOptions);
			};
			return ;
		}
		if (json.success) {
			if($.isFunction(ajaxOptions.Success)){
				ajaxOptions.Success.call(this,json.data,'success',ajaxOptions);
			}
		}else{
			if ($.isFunction(ajaxOptions.Error)) {
				ajaxOptions.Error.call(this,json.msg,'error',ajaxOptions);
			};
		}
	}
});