Here’s the desired flow that I am looking for :
- Large data (table) is passed to Spring Controller through a javascript function.
- Controller processes the data.
- Controller returns a new ModelAndView
- Render this new ModelAndView on the screen.
I am trying to send data to controller using an Ajax call. However, the returned modelandview ends up as a response to the ajax call, and as a result does not get rendered on the screen.
Is there a away I can avoid this behavior. Or perhaps, an approach to achieve the flow I am looking for?
Thanks.
If you want to refresh the whole page, using AJAX doesn’t bring any advantage.
If you only want to refresh some part of the page, then you need to provide a JavaScript callback function that will use the AJAX response, and modify the DOM of the current page.