获取页面内容封装成json对象
2021-06-19 00:06
标签:return mil gif var each data params i++ ring function(params, dom){ 获取页面内容封装成json对象 标签:return mil gif var each data params i++ ring 原文地址:http://www.cnblogs.com/xiaolin-peter/p/7195992.html
var courseName= document.getElementsByName("courseName");
var teacherName = document.getElementsByName("teacherName");
var courseId = document.getElementsByName("courseId");
var courseList = [];
for(var i=0; i
if(courseId.length > i){
var id = courseId[i].value;
}
else id = ‘‘;
var course = { "id": id, "name":courseName[i].value,"teacherName":teacherName[i].value};
courseList.push(course);
}
console.info(courseList);
params.courseList = courseList;
params = {data:JSON.stringify(params)};
return params;
}