在别的地方看到的 出处现在找不到了
function post(URL, PARAMS) { var temp = document.createElement("form"); temp.action = URL; temp.method = "post"; temp.style.display = "none"; for (var x in PARAMS) { var opt = document.createElement("textarea"); opt.name = x; opt.value = PARAMS[x]; // alert(opt.name) temp.appendChild(opt); } document.body.appendChild(temp); temp.submit(); return temp; }
调用的请求
post('pages/url.action', {html :prnhtml,cm1:'balabala',cm2:'haha'});