How to modify the POST data in javascript?
I have a scenario like below:
I navigate to the reader page with the below form data
<form id="mainForm" action="Reader.aspx" method="post">
<input type="hidden" id="bookId" name="bookId" />
<input type="hidden" id="startPageId" name="startPageId" />
</form>
Initially the hidden variable values will be bookId=1 and startPageId=5
I navigate between the pa开发者_如何学编程ges by using javascript and assume the startPageId will now change to 8
I want the new value to be stored in the above form data and want to submit the same page with different form data bookId=4 startPageId=10
When I click on the browser back button, I want the user to be navigated back to the BookId=1 and startPageId=8
Can anyone help me how I can achieve this?
You can user JHistory, check out this. http://plugins.jquery.com/project/jHistory http://www.overset.com/2008/06/18/jquery-history-plugin/
It will work correctly in FF and Chrome, it means that the values that you set using javascript will be the same values that you have set. I had problems in IE (then I worked on similar functionality it was IE7). To resolve it I had to store required values in Session object and download it using ajax each time the page is shown (even when back button click). Don't know if it helpful in your situation. :)
精彩评论