Tag: 弹簧

如何在spring mvc中将对象从控制器返回到ajax

我必须将员工列表从Controller返回到jQuery ajax。 我该怎么做呢? //controller part @RequestMapping(“phcheck”) public ModelAndView pay(@RequestParam(“empid”) int empid, String fdate, String tdate) { ModelAndView mav = new ModelAndView(“phcheck”); List emp=entityManager.createQuery(“select e from Employee e where e.empId=”+empid, Employee.class).getResultList(); mav.addObject(“emp”, emp); <—-I need this list of employee in ajax return mav; } 视图中的Ajax //Ajax part $(document).ready(function () { $(“#empid”).change(function () { if ($(“#fdate”).val() != […]