This topic is locked

Update (reload) image on list page without refreshing entire list page

10/18/2012 11:16:48 AM
PHPRunner General questions
C
copper21 author

Hello all,
Yesterday Cristian assisted me with some buttons on the list page. The buttons, when clicked, entered data into another table and checked if records existed in that other table. All works great! Here is the link to it: http://www.asprunner.com/forums/topic/20176-checking-if-data-exists-in-another-table-in-a-button/ Now I have a field called "image_value" on that list page that is set to "View As Custom" and is on the same list page as the two buttons. The buttons show up for every line of data that is presented on the list page. The "image_value" field can have a value of 1 or 0. When I click one button, for example, it gives this field a value of 1. When I click the other button, it gives this field a value of 0.
As mentioned before, the "image_value" field is set to "View As Custom" and has the code listed below in it which works fine, but a page refresh is required in order for the correct image to show up if I press the button that changes the value of that field. My question is this: Is there a way to refresh the image without refreshing the whole page? So for instance the field has a value of 1 when I first load the page and then I click the button that changes the value to 0 it automatically changes the image without refreshing the entire page?
I am guessing I will need to know the id's of the button and can use a jquery maybe?...If this is even possible. I have done a bit of research and this is similar to changing the Captcha image when a user cant read the one they have and want another one.
Here is the simple "View As Custom" Code:
if($data['image_value'] == 1)

{

$value = "<img height=26 width=60 src= images/pic1.png>";

}

else if ($data['image_value'] == 0)

{

$value = "<img height=26 width=60 src= images/pic2.png>";

}
Thank you in advance,
Brian