I have written a small script using prototype. I have two drop down boxes. The choices in the second one depend on the first one. So I use ajax to get the choices and populate the boxes. When the second box is selected, I wrote a function to initiate a Ajax.PeriodicalUpdater call to refresh a div tag every few seconds. So far, so good. Everything is working. I'm able to see an image(I displayed it) refresh itself.
Now, when I select another option from the second box, the new image is appearing but the old one is coming too. I mean, first the old one comes, then refreshes into the second one. I've been trying to get over this problem but in vain. Can someone please help me out? Just in case, my problem is something like:
Once I click on a submit button, I need to send the request to a php file which will give me an image file which i'm displaying. Now, I need to keep sending the POST data every few seconds so that the php file generates a new image and gives it back. This image should be displayed here on this page. The page can be seen here: