Home > Back-end >  One day meet a problem (a list <entity class> front stitching)
One day meet a problem (a list <entity class> front stitching)

Time:11-30

How to splice for the list: [{}, {}]
The background for the
Public AjaxResult addList (@ RequestParam List< (value="https://bbs.csdn.net/topics/list"); ExamPaperAnswerRecord> The list) {
Return toAjax (examPaperUserRecordService addList (list));
}
The front end
The function submitHandler () {
Var params=[];
$(" input [name='score'] "). Each (function (I, ele) {
Var param={};
"QstId" param []=$(ele). Attr (" data - qstId ");
Param [" score "]=$(ele). Val ();
//param. Push ($(ele). Attr (" data - qstid "));
//param. Push ($(ele). Val ());
Params. Push (param);
});
The console. The log (JSON. Stringify (params))

Save (prefix + "/addList", JSON. The stringify (params));
}
But there is no name printed, pass behind to do much more:
  • Related