I’m using jcrop and have written a dynamic way of saving the cropped image without changing the page. Basically I write the new cropped profile picture to the same filename as previously, and load it to a div. However what happens instead is the old image remains because it assumes its the same image. Its not until I refresh the page and see the new file loaded again that i can see the changes.
Is there a function to force a refresh on an image?
add a
?123at the end of thesrcattribute of the image. 123 is a random number generated everytime you update the image.$('.my-img').attr('src',$('.my-img').attr('src')+'?' + ((Math.random() * 1e6) | 0));