JS提交POST

function toQrPay(id) {
    var parames = new Array();
    parames.push({name: "pay_id", value:id});
    Post("/pay/wxzf/addprice.php", parames);
    return false;
}
function Post(URL, PARAMTERS) {
    //创建form表单
    var temp_form = document.createElement("form");
    temp_form.action = URL;
    //如需打开新窗口,form的target属性要设置为'_blank'
    temp_form.target = "_self";
    temp_form.method = "post";
    temp_form.style.display = "none";
    //添加参数
    for (var item in PARAMTERS) {
         var opt = document.createElement("textarea");
         opt.name = PARAMTERS[item].name;
         opt.value = PARAMTERS[item].value;
         temp_form.appendChild(opt);
        }
    document.body.appendChild(temp_form);
    //提交数据
    temp_form.submit();
}

  JS提交POST

posted @ 2022-10-15 23:46  学画人生  阅读(106)  评论(0编辑  收藏  举报