Sai Prasad
Sai Prasad

Reputation: 163

Retaining of page using pagination in jQuery after performing few actions on the page

I am using JQuery for pagination. I have a button in that page, when clicked information is stored in back end and the page gets refreshed.

But after refreshing i am able to see the first page of pagination and not the page in which I ckicked.

Upvotes: 0

Views: 711

Answers (1)

Thomas Stock
Thomas Stock

Reputation: 11256

Save the current page in a hidden input element.

In your backend you can probably access form elements if you need to do something with the pageNumber there. In asp.net the hidden field should still contain the pageNumber so you could re-set the paging in jquery after postback.

Alternatively, you could edit the form's action attribute to set a pageNumber as an url parameter. Like this:

$("form").attr("action", "my_web_page.php?pageNumber=" + $("#my_hidden_pageNumber").val());

Then on loading your page after the postback, you set the right page in jquery again using the url parameter. There's a plugin here for easily reading url parameters: http://www.mathias-bank.de/2007/04/21/jquery-plugin-geturlparam-version-2/

Upvotes: 2

Related Questions