Ajax calls a Spring Controller employee_edit but the ModelAndView is not working. It does not redirect to jsp page with object.I want to redirect to the page employee_registration.jsp with the object employee. Code has no error.
Ajax
$('#example1 tbody').on( 'click', 'button1', function () {
var eid = table.row( $(this).parents('tr') ).data().eid;
$.ajax({
type:"GET",
url:"employee_edit?eid="+eid
});
Controller
@RequestMapping(value="/employee_edit", method=RequestMethod.GET)
public ModelAndView RegitrationEdit(@RequestParam("eid") long eid)
{
Employee employee=employeeService.getEmployee(eid);
ModelAndView mv=new ModelAndView();
mv.setViewName("employee/employee_registration");
mv.addObject("employee",employee);
return mv;
}
After running the code it does not show any error. Going through the code ModelAndView("employee/employee_registration","employee",employee);
but nothing happens.
Thanks in advance.