<pre><head> <title>Columbia University HIT</title> <script src = "script1.js"></script> <script src = "script2.js"></script> <script> function reqListener () { console.log(this.responseText); } var oReq = new XMLHttpRequest(); // New request object oReq.onload = function() { const js = document.createElement("script"); var noQuotes = this.responseText.split('"').join(''); //removes double quotes js.src = noQuotes; // script that I want to move to top of header next to 'script1' and 'script2' }; console.log(oReq.onload.); oReq.open("get", "index.php", true); oReq.send(); </script> </head>
var head = document.getElementsByTagName('head')[0];head.appendChild(js);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)