What the OP is asking is vague, but I’m trying to answer it the way I understand it.
How can I use functionality of a 3rd party library hosted on another site?
So basically, a webpage typically exists of HTML, Javascript and CSS. Currently we are just interested in Javascript and CSS.
So what we do is this:
1. Load the Script sources you would like to use!
2. Execute javascript that utilizes those loaded script sources
An example where we load the jQuery library: (Working codepen: https://codepen.io/iwantwin/pen/vemEXe)
<html>
<head>
<!--Import 3rd party library like this-->
<script
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g="
crossorigin="anonymous"></script>
<!-- Execute it after that was loaded -->
<script>
//Use the library --> '$' is loaded here as an dependency, so we are using the library!
//Use the library for the event handling
$(document).ready(function(){
//Use the library for the html binding
$('#result').html('Jquery loaded');
});
</script>
</head>
<body>
<div id="result">Loading jquery...</div>
</body>
</html>
In jQuery, it’s not as clear an example as what you use in your post, but that is really so vague, and just an example anyways, that I sticked to explaning using any 3rd party library to use 🙂
2
solved How to connect to a url in Javascript