Once again I came face to face with a problem that seemed insurmountable. That little piece of nuisance that just seems to make your code not what you expect it to be. To put it simply, all I needed to do was to prevent an image I kept reloading dynamically from the server from being cached. A common problem faced by any new AJAX developer, and once again after Googling my ass off, I came across the solution to prevent caching on the client side.
The solution: “Append a random query string to whatever you are requesting from the server to prevent it from being cached”.
To prevent an image from being cached (which was my case), you could try something like this (PHP CODE Below):
// return image to be displayed
echo ‘<img src=”‘ . $_POST[‘Picture’] . ‘?’ . rand(1,100) . ‘” width=”150″>’;