Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getDataFromURL(url) {
- affixScriptToHead("https://code.jquery.com/jquery-3.1.1.min.js", function() {
- $.get(url, function( data ) {
- x = data
- });
- });
- function loadError(oError) {
- throw new URIError("The script " + oError.target.src + " didn't load correctly.");
- }
- function affixScriptToHead(uri, onloadFunction) {
- var newScript = document.createElement("script");
- newScript.onerror = loadError;
- if (onloadFunction) { newScript.onload = onloadFunction; }
- document.head.appendChild(newScript);
- newScript.src = uri;
- }
- return x;
- }
- // Example Use
- getDataFromURL("https://pastebin.com/raw/PzgesDhD");
Advertisement