window.open (参数使用post方式提交)

function openPostWindow(url, data, name){
   var tempForm = document.createElement("form");
   tempForm.id="tempForm1";
   tempForm.method="post";
   tempForm.action=url;
   tempForm.target=name;
   var hideInput = document.createElement("input");    
   hideInput.type="hidden";
   hideInput.name= "content";
   hideInput.value= data;
   tempForm.appendChild(hideInput);     
   tempForm.attachEvent("onsubmit",function(){ 
  openWindow(name); 
});
   document.body.appendChild(tempForm);    
   tempForm.fireEvent("onsubmit");
   tempForm.submit();
   document.body.removeChild(tempForm);
}
function openWindow(name){
window.open('',name,'height=400, width=400, top=0, left=0, toolbar=yes, menubar=yes, scrollbars=yes, resizable=yes,location=yes, status=yes');

}

调用方式:

var dataVo = $('#Confirm').serializeArray();
var nodes = $('#treeModel').tree('getChecked');
var ids = [];
for ( var i = 0; i < nodes.length; i++) {
ids.push(nodes[i].id);
}
if(ids == ''){
$.messager.alert('提示','请选择要导出的标准体系!','warning');
return ;
}
var dataJson = convertToJson(dataVo);
dataVo = JSON.stringify(dataJson);
//var url = baseurl + "/platform/stndSystemController/exportData?datas="+dataVo+"&ids="+ids;
var url = baseurl + "/platform/stndSystemController/exportData?datas="+dataVo;
openPostWindow(url, ids, "_blank");



你可能感兴趣的:(web前端)