1

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?

2 Answers 2

1
$('#userPhoto').find('img').attr('src', ['/your/path/', newFilename].join(''));
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.