'Chrome does not show modal within javascript click event

I have a bootsrap 4 css framework with jquery. By Clicking a button i want to show a modal box with progress status information. In firefox the modalbox is opening directly, in chrome the box is not shown before the end of the event function.

Example

$('#myButton').click(function(){
   $('box').modal({show:true,backdrop:false}); // open modal box
   App.data.forEach(function(data) { 
     status = status + (100/App.data.length);
     $('#box .progress-bar').css('width',parseInt(status)+"%");
     // do some fancy ajax calls 
   });
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source