首页 > 代码库 > js跨域post请求
js跨域post请求
1 function funPostBack(srvMethod){ 2 /* 3 var contentNR=$(document.getElementById("reportFrame").contentWindow.document).find("#content-container").html(); 4 contentNR=$("#x").text(contentNR).html(); 5 contentNR=contentNR.substring(0,400000); 6 if(exec_obj==null){ 7 exec_obj = document.createElement(‘iframe‘); 8 exec_obj.name = ‘tmp_frame‘; 9 exec_obj.src = http://www.mamicode.com/postbackUrl+"?parms="+contentNR; 10 exec_obj.style.display = ‘none‘; 11 document.body.appendChild(exec_obj); 12 }else{ 13 exec_obj.src = http://www.mamicode.com/postbackUrl+"?parms="+contentNR; 14 }*/ 15 16 var contentNR=$(document.getElementById("reportFrame").contentWindow.document).find("#content-container div.pageContentDIV.contentDIV").html(); 17 if(document.getElementById("SMAL")!=null) 18 { 19 document.getElementById("SMAL").remove();//首先删除 20 } 21 var form ="<form action=‘"+postbackUrl+"‘ method=‘post‘>" + 22 "<input type=‘hidden‘ name=‘parms‘ value=http://www.mamicode.com/‘‘/>" + 23 "<input type=‘hidden‘ name=‘srvMethod‘ value=http://www.mamicode.com/‘‘/>" + 24 "</form> "; 25 $("body").append("<iframe id=‘SMAL‘ name=‘SMAL‘ style=‘display: none‘></iframe>");//载入iframe 26 $( "#SMAL" ).contents().find(‘body‘).html(form);//将form表单塞入iframe; 27 $( "#SMAL" ).contents().find("form input[name=‘parms‘]").val(contentNR); 28 $( "#SMAL" ).contents().find("form input[name=‘method‘]").val(srvMethod); 29 $( "#SMAL" ).contents().find(‘form‘).submit(); 30 }
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。