Updated text fields to JSON string
This question already has an answer here:
Here is the solution, iterate through each row, find values of textbox and push it to array and finally convert it to string. you can set that string in hidden field to pass it to server side.
var ArrColleague = [];
$("#subdetails").click(function () {
$("#mantab tr").each(function (index, val) {
ArrColleague.push({
"c1nametb": $(val).find("#c" + $(val).attr("id") + "nametb").val(),
"c1unametb": $(val).find("#c" + $(val).attr("id") + "unametb").val(),
"c1eaddtb": $(val).find("#c" + $(val).attr("id") + "eaddtb").val(),
"c1pnotb": $(val).find("#c" + $(val).attr("id") + "pnotb").val(),
"c1exttb": $(val).find("#c" + $(val).attr("id") + "exttb").val()
});
});
});
var JsonString = JSON.stringify(ArrColleague);
链接地址: http://www.djcxy.com/p/46336.html
上一篇: 从表单到javaScript地图
下一篇: 将文本字段更新为JSON字符串