I am using Spring MVC , example.jsp file with Javascript.
I have been stuck on this for a long time.
Is it possible to use Javascript to laod new data from DB into HTML tables without refreshing the whole page?
I just don’t want my whole page being replaced when new data is loaded into table with some event.
If you want to reload a part of you page using JavaScript, basically AJAX.
This is how you should do it.
Client Side
Let’s assume that you’re using jQuery as a JavaScript Framework.
You’ll need to use jQuery.ajax() in the Client Side.
Call the
reloadData()function when you need to reload the table.Server Side
You’re using Spring MVC. Then your Controller should look like:
You don’t have to use JSON but I think this is the best way.
Hope this will help you.