﻿//返回远程数据，
//URL:文件名称，例：/demo/a.aspx
//CALLBACK 回调函数
//例：REQUEST('/demo/test.aspx','#demo');
Server="/";
function REQUEST(URL,DIV,CALLBACK,PARAM){
$(DIV).empty();
$(DIV).append("<div style='padding:3px;'><img src='/images/ajax_load.gif'></div>");
$.ajax(
	   {  
	    type: "post",  
	    url: URL,  
		data:PARAM,
	    beforeSend: function(XMLHttpRequest){  
	    //ShowLoading();  
	    },  
	    
	    success: function(data, textStatus){  
	    CALLBACK(data);  
		},
		
	    complete: function(XMLHttpRequest, textStatus){   
	    //HideLoading();  
	    },  
	    
	    error: function(){   
	    $(DIV).empty();
	    $(DIV).append("系统繁忙，请稍后再试"); 
	    }
	    }
	    );
}
function REQUEST_DIV(URL,DIV,PARAM){
DIV="#"+DIV;
$(DIV).empty();
$(DIV).append("<div style='padding:3px;'><img src='/images/ajax_load.gif'></div>");
$.ajax(
	   {  
	    type: "post",  
	    url: URL,  
		data:PARAM,
	    beforeSend: function(XMLHttpRequest){  
	    //ShowLoading();  
	    },  
	    
	    success: function(data, textStatus){  
		$(DIV).empty();
	    $(DIV).append(data);
		},
		
	    complete: function(XMLHttpRequest, textStatus){   
	    //HideLoading();  
	    },  
	    
	    error: function(){   
	    $(DIV).empty();
	    $(DIV).append("系统繁忙，请稍后再试"); 
	    }
	    }
	    );
}
function REQUEST_DIV1(URL,DIV){
$(DIV).empty();
URLS=URL.indexOf("?");
URLO=URL.substr(0,URLS);
PARAM="&"+URL.substr(URLS+1,URL.length-URLS-1);

$(DIV).append("<div style='padding:3px;'><img src='/images/ajax_load.gif'></div>");
$.ajax(
	   {  
	    type: "post",  
	    url: URLO,  
		data:PARAM,
	    beforeSend: function(XMLHttpRequest){  
	    //ShowLoading();  
	    },  
	    
	    success: function(data, textStatus){  
		$(DIV).empty();
	    $(DIV).append(data);
		},
		
	    complete: function(XMLHttpRequest, textStatus){   
	    //HideLoading();  
	    },  
	    
	    error: function(e){  
	    $(DIV).empty();
	    $(DIV).append("系统繁忙，请稍后再试"); 
	    }
	    }
	    );
}
function REQUEST_script(URL,PARAM){
$.ajax(
	   {  
	    type: "post",  
	    url: URL,  
		data:PARAM,
		dataType: "script",
	    beforeSend: function(XMLHttpRequest){  
	    //ShowLoading();  
	    },  
	    
	    success: function(data, textStatus){  
		//alert(data);
		},
		
	    complete: function(XMLHttpRequest, textStatus){   
	    //HideLoading();  
	    },  
	    
	    error: function(){   
	    }
	    }
	    );
}
