I want to load this script dynamically and it contains data attribute
<script class="podigee-podcast-player"
src="https://cdn.podigee.com/podcast-player/javascripts/podigee-podcast-player.js" data-configuration="https://pt.podigee.io/embed?context=external">
</script>
I tried this. But it didn't work for me. Is it a correct way to set data-configuration attribute? Where I am making mistake?
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = 'https://cdn.podigee.com/podcast-player/javascripts/podigee-podcast-player.js';
script.class = 'podigee-podcast-player';
script.dataset.configuration = 'https://pt.podigee.io/embed?context=external';
var s = document.getElementsByTagName("body")[0].appendChild(script, s);
script.setAttribute('data-configuration', 'https://pt.podigee.io/embed?context=external')