Search code examples
htmlajaxjquerydwr

Question on getting data from AJAX


I have a pagination table which has controls like left arrow/right arrow and a text box to directly enter any page number. Below that there is a table with 5 cols and 5 rows

Now I want to update the column data each time the user does any action (e.g. left arrow pressed) without refreshing the page. So I am obviously looking for an AJAX based solution (can be with a combination of jQuery or DWR, etc)

But my main question is this; Since the table structure (HTML code) is already part of a JSP and I only need to replace the data in multiple places, do I have to make multiple AJAX requests OR it can be handled with just 1 AJAX request? If yes, please let me know how it can be done.


Solution

  • How about split the table part to another jsp and include it to your main jsp? When user changing page then you make ajax request to retrieve data and set the view to your new jsp file. Then replace the table with new html data you get back from ajax.

    But if your table need more feature like sort column or anything else then I recommend you to use existing grid in JQuery.