Form values are not changing even on page reload
Hi I'm using jquery to allow a user to click a row in a table to edit the contents of it. When the user clicks the row, a javascript function is fired which sends the row_id as a parameter and stores it in a hidden form. A function is fired which posts the row_id stored in the hidden form. The row_id is used in a php script to find the contents of the row which are stored as an array in a session variable. A div showing a form is shown on the screen, with the contents of the session variable in input field, to show the user the current values and allow them to be easily changed if the user needs to do this...
The first time the page is visited, and a row is selected this all works fine and the correct values are shown in the form, but if I close the form or click cancel and select a different row the values in the form are the same as the previous ones. Even stranger, if the page is reloaded after an attemp开发者_运维技巧t to select a second row, clicking any row the third time once the page is reloaded brings up the previous row selected before the page was reloaded. I have tried EVERYTHING and can't seem to make it work. Here goes with the code...
Any ideas would be greatly appreciated I'd love to know where I'm going wrong!
The problem appears to be that your JavaScript code is hard-coded to show just one particular row. In the code that handles the "$.post()" response, you've got PHP code to dump out a row. The problem is that that code runs just once, and it runs on the server before the page is sent to the client. Once it's at the client, the values there are frozen and won't change regardless of what comes back from the ajax call.
精彩评论