http://blog.csdn.net/zhang_j_h/article/details/44563167
存入:
function GetInputData(id, cmd) {
var postdata = "{ "action":"" + cmd + "",";
("#" + id + " input[type!='checkbox']").each(function () { postdata += """ + $(this).attr("name") + "":"" + $(this).val() + "","; });("#" + id + " input[type='checkbox']").each(function () {
postdata += """ + (this).attr("name") + "":"" + this.checked + "","; });("#" + id + " select").each(function () {
postdata += """ + (this).attr("name") + "":"" + this.value + "","; });("#" + id + " textarea").each(function () {
postdata += """ + $(this).attr("name") + "":"" + this.value.replace(/
|
/g, "<br>") + "",";
});
postdata = postdata.substr(0, postdata.length - 1);
postdata += "}";
return eval("(" + postdata + ")");
}
提交:var json = GetInputData("AthleteViolationInfoForm", "submit");
读取:
$("#ipt_actionresult").val(dataObj.ipt_actionresult.replace(/<br>/g, ' '));//读取数据时把数据匹配正则替换正确的回车符号(符合的编码,用于正确显示)
alue.replace(/<br>/g, "");//替换换行为空
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
博文来源广泛,如原作者认为我侵犯知识产权,请尽快给我发邮件 664507902@qq.com联系,我将以第一时间删除相关内容。