I want to call a variable, which stores some html markup with some data, when my URL contains a specific string. The data is accesible after a timeout function I made, and the console spits out the correct markup.
var mapData = setTimeout(function() {
var mapContent = $('.case__map').html(); // THIS DATA I WANT
},3000)
if (window.location.search == '?print=1') {
$('.presentation-list').find('[data-type="image"]').each(function () {
var src = $(this).attr('data-src');
$('.newData').append('<div><img src="' + src+ '"/></div>')
});
// HERE I WANT TO APPEND THE DATA INSIDE "MAPCONTENT" TO A NEW DIV
// HOW TO ACHIEVE THIS?
}
any help is appreciated