How to append an image using jquery to Div element through ajax I have an ajax response where the object is as follows
https://drive.google.com/open?id=0B4WeiY_22ZtkMnNDMkQ1cUQ3SVE
and I want to append the image to a div
$('#DisplayImage').empty().append('<img (src)="response.unit_plan_images.UnitImage" height="64px" width="64px">'); // not sure if this is correct
can you please assist me
I think it's because you have the response.unit_plan_images.UnitImage within the quotes of the img src, so it thinks that string is literally the url of the image instead of the data from your json object. Break out of the quote and concatenate.
'<img src="'+response.unit_plan_images.UnitImage+'" height="64px" width="64px">'
Also not sure why you had parenthesis around src?
'<img src="images/'+response[0].unit_plan_images.UnitImage+'" height="64px" width="64px">'
I had src put in brackets because laracast was displaying the image in the tag for some reason. Thanks though
Please sign in or create an account to participate in this conversation.