dynamic background image not display on bootstrap modal

Viewed 70

I want to dynamic change the background image and details on bootstrap modal by using ajax I get all images from database and my modal is working fine every id showing right data I'm facing problem showing background image

here's modal code image enter image description here

Ajax code enter image description here

I do getting right URL for image like https://example.net/uploads/16188133891985.jpg and right image for every id problem is when I pass that image to modal body it's not working and modal look like this

enter image description here

if anyone can help me what I'm missing my ajax working fine I'm getting all data as well as image

thank you

1 Answers

Why are you setting the attribute 'data-bg-src'? That wont change a background image.
You have to change the style, which with jquery would be something like:

$('#aboutModal').css('background-image', 'url('+pathToImage+')');
Related