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);

              }

           });

}

 

你可能感兴趣的:(form)