Greeting,
I want to add jquery cdn in Reactive Web app Globally. for a particular screen i am using RequireScript in my client action. to load the library. thanks in advance :)
Hi Anand
You can set/reference the jQuery library in the Application module as well as in Screen scope by referencing the jQuery library file available in the OutSystemsUI module (using Mange Dependency) as shown below
Hope this helps you!
Regards,
Benjith Sam
Benjith Sam wrote:
thanks for quick responsebut i want to add cdn globally not the script fileRegards
anand kumar wrote:
Hi Anand,
I think by defining the below mentioned script
1) either by creating a new script file and referencing the same in the application module
2) In the Screen common Layout, define the block On Initialize event handler action flow within which introduce the JS node with the below script will do the work
var script = document.createElement("script"); script.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"; script.async = true; script.defer = true; document.getElementsByTagName("body")[0].appendChild(script);
from: https://success.outsystems.com/Documentation/11/Extensibility_and_Integration/JavaScript/Extend_Your_Mobile_and_Reactive_Apps_Using_JavaScript/Use_JavaScript_Code_from_an_External_Library
hey,
I made a custom block in UI Common flow and added the script you gave,so when i added jquery in client action and published to use it, it's giving error $ is not defined
Hi anand,
I totally agree with Daniël's comment...
The error which you encountered clearly states that you might have used the jQuery syntax or $ - jQuery selector (within the newly introduced block) before successfully loading the jQuery library from cdn location
Is their a way to prevent it??