Add external JS file with liaAddScript
Hi guys,
is it possible to pass some kind of parameter to <@liaAddScript> where I can define an url to an external JS file?
In my current use case the file is the jquery-cookie plugin and is located in the assets library.
The challenge is that jquery plugins require the jquery library to be loaded first and I can ensure this only by using <@liaAddScript>.
Thanks for your help in advance.
Nikolay
Hi Nikolay,
I don't think you can do this in the <@LiaAddScript> , but maybe what you can do is to use LiaAddScript to dynamically load the external script and then evalutate it, or use something like jQuery.getScript
So your code can be then written when you are sure that the external library has actually been loaded. Of course there are security implications when doing this but in this case it should be okay as you are loading a script you actually control.
Hope this helps,