您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
var HOST = 'http://hummer.baidu.com'; var autoAjax = function(data){ if(!data || typeof data != 'object') return; var rnd = new Date().getTime(); if(!data.proxy) data.proxy = HOST + '/static/proxy.html?_='+rnd; var name = 'postIframe'; var proxyhost = /^((?:[^:\/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?(?:[^#]*))?(?:#(.*))?$/.test(data.proxy); proxyhost = RegExp.$1 + RegExp.$2; var _host = /^((?:[^:\/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?(?:[^#]*))?(?:#(.*))?$/.test(data.url); _host = RegExp.$1 + RegExp.$2; var _domain = 'http://' + location.host; var _back = function(ret){ try{ if(typeof ret === 'string'){ ret = ret.replace(/^[^{]+/img,''); ret = $.parseJSON(ret); } if(!!ret.source){ ret = ret.data; } if(typeof ret === 'string') ret = $.parseJSON(ret); }catch(_err){ ret = {success:1,info:'提交失败'}; } data.callback(ret); }; if(_domain === _host && _host != ''){ var _data = {data: data.data}; var ajax = $.ajax({ type:'post', url: data.url, data: data.data }); ajax.always(_back); }else{ var oFrame = $('#'+name); if(!!oFrame.length){ oFrame.attr('src',data.proxy); }else{ oFrame = $('<iframe name="'+name+'" id="'+name+'" src="'+data.proxy+'" ></iframe>').appendTo(document.body); } var msg = { url: data.url, data: data.data }; if(typeof msg == 'object'){ msg = JSON.stringify(msg); } window.onmessage = _back; oFrame.unbind('load').load(function(){ this.contentWindow.postMessage(msg,HOST); }); } } var data = { url: "对应接口", callback: function(ret){ /*if(ret && ret.success == 0){ setCurrentDate(); createSearchList(ret); }else if(ret && ret.success == 2){ return poplayer({msg: ret.info,icon:'error',after:function(){ location.href = (ret.login_url || API.login); }}); }else{ return poplayer({msg: (ret ? ret.info : '获取查询列表失败'),icon:'error'}); }*/ console.log(ret); } }; autoAjax(data);
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。