通過創建節點,添加表單,最后添加到body子標簽中
function htmlPost(){
var data = {"test","測試"}
myPost("url",data)
}
function myPost(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.test = x;
temp.appendChild(opt);
}
document.body.appendChild(temp);
temp.submit();
return temp;
}