I would like to have a script in the head like this:
<script type="text/javascript" id="scriptid" src="https://accountName.cloudServiceURL.com"></script>
I would like to make the “accountName” to be able to be changed depending on the person using the template file.
So I have created a variable like this
<script type="text/javascript">
var claccount = 'accountName';
</script>
So then I am trying to use this to let folks add their own account name like this:
<script type="text/javascript" id="scriptid" src="https://' + accountName + '.cloudServiceURL.com"></script>
Does jQuery prevent doing this type of thing with scripts because I do this all the time with anchors and other things.
I have also tried to insert a script tag into the head using jquery but it seems that it is not possible.
You can load the script dynamically. Instead of having the separate script tag in the head for the script in question, you can load it dynamically when you resolve the account name like so: