I am trying to replace this line of HTML with some javascript code that will dynamically load the script, and provide a callback once the script is loaded.
<script type="text/javascript" src="https://www.dropbox.com/static/api/2/dropins.js" id="dropboxjs" data-app-key="SOME VALUE HERE"></script>
I can use jquery's $.ajax()
function to load the file, but how do I set the data-app-key
value?
$.ajax({
dataType : 'script',
cache : true,
url : 'https://www.dropbox.com/static/api/2/dropins.js',
complete : onApiLoad,
});