phpjavascriptjqueryhtmlsrc

Cache problem on changing <img> src attr with same file name


i'm trying changing dinamically the src path of a img tag

i have:

<img src="img1.jpg">

Then i upload new photo by iframe and new photo takes the same name (img1.jpg) then by ajax i refresh the src path (which is the same but photo is changed)

The problem is that i use same file name, img doesn't change in browser, guessing cause of browser cache...

Is there any jquery,html or php solution on this?

thanks


Solution

  • You could try appending a random query string to the end... img src="img1.jpg?random_string"