lundi 9 janvier 2017

loading image into view after ajax call

Here is the problem I ran into just now. I have a chat function part of my laravel application that loads respective users images as they type in the conversation. What I cannot figure out is when I append the url for the profile picture into the view, it will not actually display the picture, it just shows a "placeholder" of where the picture should be.

I know the code works for a fact because I can see in the console log the correct path for the picture inside the assets folder.

So my question is how would I display a picture after retrieving info from an ajax call.

$('.chat-wrapper').append(
                    "<div class='message " + sent + "'>" +
                    "<div class='media-left'>" +
                    "<a href=''><img scr=" + data.profilePicture + " class='img-circle img-50x50' title=''></a>" +
                    "</div>" +
                    "<div class='media-body'>" +
                    "<small class='small-gray p-l-10 pull-right'>" + data.time + "</small>"+
                    "<div class='heading'>" +
                    "<span>"+data.authorUserName+"</span>" +
                    "</div>" +
                    "<p>" + messageText + "</p>" +
                    "</div>" +
                    "</div>"
            );

Thank you for the help in advance!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire