I have an onclick event that loads up an iframe. I need to be able to dynamically change part of the URL that is in the onclick even event. What's the best possible way to do this? The part I need to dynamically replace I highlighted below as ****variable here***.
var ****variable here*** = '343h343432e';
<button type="button" id="load_2" class="btn btn-info" onClick="document.getElementById('attri_map').height = '520';document.getElementById('attri_map').src='https://example.com/****variable here***';document.getElementById('load_2').style.display = 'none';">Click to Load</button>
<iframe id='attri_map' width='100%' height="0" frameborder='0' allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>
var varName = {key: "urlPart", data: {anything else}}