zoukankan      html  css  js  c++  java
  • js创建post请求

    /**js提交post请求:隐藏请求参数**/
    function
    postDetail(URL, PARAMTERS) { //创建form表单 var temp_form = document.createElement("form"); temp_form.action = URL; //如需打开新窗口,form的target属性要设置为'_blank' temp_form.target = "_blank"; 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(); }

    //调用

    //var param = new Array();
    //param.push({ "name":"id","value":"id123"});

    //var serverUrl = "/a/save";
    //postDetail(serverUrl,param);

     
  • 相关阅读:
    SharedPreferences 使用
    activity在activity上面
    组合组件
    浏览器的渲染原理
    Node 入门<1>
    css 样式优先级
    z-index
    事件代理
    XSS && CRLF && property&attribute
    webpack 学习笔记
  • 原文地址:https://www.cnblogs.com/xmqa/p/10255085.html
Copyright © 2011-2022 走看看