当前位置:编程学习 > JAVA >>

form表单数据的封装

function fsq() {

    var fmStr = "fm=fm";

    var fmE = document.fm.elements;

    for (var i = 0; i < fmE.length; i++) {

       fmStr += "&" + fmE[i].name + "=" + fmE[i].value;

    }

    $.ajax({

              type : "POST",

              url : "1.jsp",

              data : fmStr,

              success : function(msg) {

                  var dataRs = eval("(" + msg + ")");

                  alert("Data Saved: " + dataRs.msg);

              }

           });

}

补充:web前端 , JavaScript ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,