1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
-
- //1473Ajax获取数据方法
- //U.CD.AjaxUrl = 'http://nodejs.1473.cn/'; //后台默认请求页面
- //U.CD.AjaxCross = "http://nodejs.1473.cn/CD.htm"; //后台跨域文件
- //U.CD.Init(); //在合适的地方例如window.onload中初始化跨域文件
- //U.ACD.Request(U.CD.AjaxUrl, (["mode", "aaa"]), U.School.aa_asyn, ([""]));//向后台传递参数的调用形式
- //U.CD.AsynJWH //辅助函数,可重写此方法,在跨域文件加载完毕后可以执行的函数。
- Namespace.register("U.CD");
- U.CD.AjaxUrl = 'http://node-back.1473.cn:3000/'; //默认请求页面
- U.CD.AjaxCross = "http://node-back.1473.cn:3000/CD.htm";
- U.CD.Init = function () {
- //U.CD.Loading.innerHTML = "开始跨域";
- U.ACD = U.A; U.CD.AsynLI(); //跨域Ajax请求的解决方法//项目调用了主项目的U.A。。。会导致跨域拒绝访问。
- }
- //---------------------------------------------------解决Ajax跨域问题------------------------------------------------------------
- //异步加载iframe跨域请求
- U.CD.AsynLI = function () {
- var i, _UCS = document.createDocumentFragment(), _UIFR, _UDE = { "U_CD": "ACD", "U_Main": "A", "U_Disk": "Adisk", "U_BG": "UB", "U_PB": "PB", "U_Pay": "PY", "reply": "RY", "U_ME": "MA", "TF": true }, _UTE = [["U_CD", U.CD.AjaxCross, "ACD"], ["U_Main", "http://main.1473.cn/index.htm", "A"], ["UL_IF", "http://www.1473.cn/NewPage.htm"]]; //_UTE = [["U_Main", "http://main.1473.cn/index.htm", "A"], ["U_Disk", "http://disk.1473.cn/index.htm", "A"], ["UL_IF", "http://www.1473.cn/NewPage.htm"], ["U_BG", "http://BMain.1473.cn/index.htm"], ["U_PB", "http://pb.1473.cn/CD.htm", "PB"], ["U_office", "http://office.1473.cn/index.htm"], ["U_Pay", "http://pay.1473.cn/index.htm", "PY"], ["reply", "http://reply.1473.cn/index.htm", "RY"], ["U_ME", "http://money.1473.cn/CD.htm", "MA"]];
- U.D.ITF = _UTE.length; //预加载的长度
- for (var i = 0; i < _UTE.length; i++) {//添加跨域访问的iframe
- _UIFR = $$("iframe", { "id": _UTE[i][0], "name": _UTE[i][0], "src": _UTE[i][1], "width": 0, "height": 0, "style": { "display": "none"} }, _UCS);
- U.MD.IframeLoad(_UIFR, [[U.CD.AsynLIFA, ([_UDE, _UTE[i][0]])]]);
- }
- document.body.appendChild(_UCS);
- }
- //异步加载Iframe成功后执行
- U.CD.AsynLIFA = function (UTE, i) {
- this.contentWindow.name = this.id;
- if (this.id == "U_Main") { for (var i in UTE) { if (UTE.hasOwnProperty(i) && i != "TF" && i != "U_CD") { (window.U)[UTE[i]] = window.frames["U_Main"].U.A; delete UTE[i]; } }; UTE["TF"] = false; }
- else { window.U["ACD"] = window.frames["U_CD"].U.A; delete UTE["U_CD"]; }
- //alert(!UTE["TF"] && !UTE["U_CD"]); //执行了2次。不对!
- (!UTE["TF"] && !UTE["U_CD"]) && (U.CD.AsynJWH());
- //alert((!UTE["TF"] && !UTE["U_CD"]));
- }
- //所有的跨域文件加载完毕,允许页面点击。在1473所有事件动态生成,鼠标点击无效。
- //异步加载完执行函数
- U.CD.AsynJWH = function () {
- }
|