jQuery: same filename, wont load issue
in html i got this:
<div id="userPhoto">
<a href="profil.php?id=<?php echo $sid; ?>">
<img src="images/profilePhoto/thumbs/<?php if($vP["photo"]){ echo $vP["photo_thumb"]; }else{ echo "noPhoto_thumb.jpg"; } ?>" style="float: left; border: 2px solid #CCC; margin-right: 5px; margin-left: 15px; margin-bottom: 2px; width: 44px; height: 48px;">
</a>
</div>
on my ajax success i have this:
$('#userPhoto').find('img').attr('src', ['/your/path/', newFilename].join(开发者_高级运维''));
Now my case is that all users only have 1 image, called userid.jpg. (e.g 1.jpg)
Now i wish to load it/refresh the image, after you inserted a new profileimage (on success), but it doesnt load because the line above, newFilename var contains the same imagename as before. (e.g 1.jpg)
How can i fix this, so it load/refreshes new even if its the same name?
Try to append a question mark and a random number to the image URL to force the browser to reload it.
精彩评论