Set ID with Jquery getScript
I need to add this script with Jquery getScript, how can I add the attribute ID?
$.getScript('https://cdn.asksuite.com/infochat.js?dataConfig=https://control.asksuite.com/api/companies/hotel-latitud-buzios', function () {
ID --> How to add this
});
Script:
<script id="script-infochat" src='https://cdn.asksuite.com/infochat.js?dataConfig=https://control.asksuite.com/api/companies/hotel-latitud-buzios'></script>
Solution 1:
getScript
has no feature that makes that possible.
Instead, create the script
element using the traditional way ($('<script></script>', attributeObject)
and append it to your document.
If you have control over the script you are importing, consider using currentScript
instead of depending on specific IDs.