Reputation: 12230
What I know how to do:
submit a search form through a regular request (not Ajax), and in the new result webpage, show the first page of a table (created by DisplayTag) that can be paginated by Ajax requests (to enable Ajax with DisplayTag I use the jQuery plagin displaytag-ajax ).
What I want to do but do not know how:
I want to create the first page of the table (based on the submitted search form) by Ajax. I.e., I want to submit the search form through Ajax and create the first page of the Ajax-paginable result table in the same webpage of the search form, without loading a new webpage.
Any ideas how this can be achieved?
Upvotes: 0
Views: 2328
Reputation: 692121
You can use the jQuery load
function to load the response from an AJAX request to a given URL into a div, and you can use the serialize
function to transform the set of inputs of your search form into a query string.
The JSP page used to generate the first page of the table should just generate the table:
<%@ page ...%>
<%@ taglib ...%>
<display:table>
...
</display:table>
Upvotes: 1
Reputation: 28936
Use jQuery.post() to submit your form via AJAX. When the response is received, remove() the form from the DOM and add() the response.
Upvotes: 1