0

控制器

 @RequestMapping(value = Array("getPatternId.html"), method = Array(RequestMethod.GET))
      @ResponseBody def getPattern(model:ModelMap,@RequestParam patternId: Long):List[Question] = {


         var list: List[Question] = questionService.findQuestionByQuestionPattern(patternId)
        var questions: java.util.List[Question] = ListBuffer(list: _*)
     questions
      }

脚本

 function getPattern(id) {

            $.ajax({
                type : 'GET',
                url : " /learnware/getPatternId.html ",

                data : ({
                    patternId : id
                }),
                success : function(response) {

                    // we have the response

                    $('#info').html(response);
                },
                error : function(e) {

                    alert('Error: ' + e);

                }
            });

        }

当我将响应作为字符串发送时,它会显示在 html 页面上,但是当我返回列表时,它不会显示数据

<div id="info" style="color:green;"></div>

当前响应将被添加到 div witn id info

4

0 回答 0