以post方式打开页面
/**
* 以post方式打开页面
* url为请求路径
* params为请求参数
* target为页面打开方式
*/
function postOpenWindow(URL,PARAMS,target) {
if(target==null) target = "_blank";
var temp_form = document.createElement("form");
temp_form.action = URL;
temp_form.target = target;
temp_form.method = "post";
temp_form.style.display = "none";
for (var x in PARAMS) {
var opt = document.createElement("textarea");
opt.name = x;
opt.value = PARAMS[x];
temp_form.appendChild(opt);
}
document.body.appendChild(temp_form);
temp_form.submit();
document.body.removeChild(temp_form);
}
使用方式
postOpenWindow(path+"/web/open/webIndex",{"accessToken" : accessToken},"_self");
示例截图
