copenndthagen
copenndthagen

Reputation: 50750

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.

Upvotes: -1

Views: 180

Answers (3)

Benz Bumroungruksa
Benz Bumroungruksa

Reputation: 198

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.

Upvotes: 0

Bhanu Krishnan
Bhanu Krishnan

Reputation: 3726

Try jquery Flexigrid

Upvotes: 2

J. Ed
J. Ed

Reputation: 6752

I suggest you don't try to re-invent the wheel, but use a ready-made grid plugin.
there are a lot (see the links here).
I've used jqgrid with much success.

Upvotes: 0

Related Questions