支持跨域的Ajax异步(请求)提交类

 

Code

 

使用示例:

1.//动态装载JS文件
if(vJS && vJS.length>3)
{  
    if(!_this.loadedJS.isInArray(vJS))
    {
        _this.loadedJS[_this.loadedJS.length]=vJS;
        LeesAjaxRequest.Get({
                                url:vJS,
                                success:function(ojs){
                                            var jsOBJ=document.createElement("script");                                                                                       
                                            jsOBJ.text=ojs.responseText;                                                                                       
                                            document.documentElement.appendChild(jsOBJ);
                                        },//end success
                                        headers:{Content_Type:"application/x-javascript"}
                        });//end Get
    }//end if ( !_this.loadedJS.isInArray(vJS))            
}//end if(vJS && vJS.length>3)

2 .//添加到工具提示竖条上
LeesAjaxRequest.Post({url:"/getToolTip.aspx",
                  params:{tooltip:title},
                  headers:{Content_Type:"application/x-www-form-urlencoded;charset=utf-8"},//如果使用Post方法,必须传入此参数,charset可以为别的
                  success:function(o){
                            var rObj=eval("("+o.responseText+")");
                            var tObj=new LeesBaseWindow(rObj["width"]+2,rObj["height"]+1,"","","","","",1,"");
                            tObj.ShowWindow(vToolBarSlider.window);
                            tObj.contentWindow.style.backgroundImage="url("+rObj["image"]+")";
                            tObj.contentWindow.style.marginLeft="1px";
                            tObj.contentWindow.style.backgroundRepeat="no-repeat";
                            tObj.contentWindow.style.backgroundPosition="0 0";
                            tObj.contentWindow.onmouseover=function(){
                                                      this.style.backgroundPosition="0 -"+rObj.height;                                                                 
                                                      _this.setShowWindow(obj);
                                                   }
                            tObj.contentWindow.onmouseout=function(){
                                                      this.style.backgroundPosition="0 0";
                                                   }
                          },
                  failure:function(){
                            alert("生成ToolTip时出错");
                          }
                      });

posted @ 2009-02-01 22:06  吾非无心  阅读(1437)  评论(1编辑  收藏  举报