Tag:Getting the database

  • JSON acquisition of database information in front-end page display method

    Time:2019-6-30

    Ajax sends a request to controller, and controller responds to a json-formatted data to the page. JSON. parse () resolves the JSON string and traverses it with $. each. @RequestMapping(“/list”) public @ResponseBody java.util.List<UserVO> List() throws Exception{ return service.get(); } <body> <div></div> </body> <script type=”text/javascript”> $(document).ready(function(){ $.ajax({ type:”get”, url:”/meihao/login/list.action”, async:true, success:function(result){ var m=”<ul>”; result=JSON.parse(result); $.each(result, function(i,n) […]