tags:

views:

23

answers:

2

I have 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>

after upload, on success i wish to replace this image(noPhoto.jpg) with the new filename and show it, so a new image appears..

(that exists in newFilename variable)

How can i do this the most simple way?

+1  A: 

In your success handler, set the image's source attribute:

$('#userPhoto img').attr('src', newFilename);

If you need more information about how to put this into a success handler, you'll need to show us some more code.

lonesomeday
A: 
$('#userPhoto').find('img').attr('src', ['/your/path/', newFilename].join(''));
jAndy