Modal with json object

Asked

Viewed 292 times

0

I need to get an image by json to appear in my modal but the modal appears but the image does not

here is my code

$("#estoque1").click(function(){
    $('#estoqueModal').modal('show');
    $(".modal-body").innerHTML += '<img src="' + dadosJSON.estoque.imgModal + '">';
});
  • 1

    Where is the ajax request code? Where is the ajax request coming from?

  • I’m not using ajax, I’m doing straight from js

1 answer

1


You must have already switched the lines right? If not do, do and test.

A few points to check... Can you print the image without being in modal? If so, try to load it asynchronously, setTimeout(function(){ $(".modal-body").innerHTML += '<img src="' + dadosJSON.estoque.imgModal + '">'; } Or put in the event "onShow" modal, see the documentation of the modal you are using.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.