Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Load JS File Demo</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> </head> <body> <script> var url = "/examples/js/test.js"; $.getScript(url, function(){ $(document).ready(function(){ document.write(str + "<br>"); // Prints: Hi there! document.write(num + "<br>"); // Prints: 15 document.write(multiplyNumbers(4, 25)); // Prints: 100 }); }); </script> </body> </html>