In this guide, please use the below example JavaScript to load external libraries from a CDN.
// Create script tag
var custom_script_tag = document.createElement( "script" );
// Add type
custom_script_tag.type = "text/javascript";
// Add source
custom_script_tag.src = "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js";
// Append script to page
$( ".new_form_wrapper" ).append( custom_script_tag );
Additional script loading examples.
// Get script library
$.getScript("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js", function() {
// Here you can use anything you defined in the loaded script
});
For AMD based libraries used with Require and Define functions.
// Define and require the necessary library
require(['//cdnjs.cloudflare.com/ajax/libs/bodymovin/5.7.4/lottie.min.js'], function( lottie ) {
// Use the specific library object
console.log(lottie);
});
For any questions, please contact us - [email protected] or the Formyoula in-app chat 🙂