0

my company has tasked me with maintaning an internal environment webpage that houses the installers for each of our environments. the format of this location is: Root > webpage.html / EnvFolders > installer.exe / version.txt

the webpage has each environment listed, along with a static link to the sub folder installer file. it also has a line for the version. when we update an environment, neither the installer or version file names change, so the link to the installer never gets out of date. the version is supposed to be manually updated, but most of the time the tech doing the update doesn't, ergo, this post.

i am needing a way to read the single line within the version.txt file and display it in on the correct env. i am looking to have a line of code at each environment listing that then triggers a single function that does the actual work of pulling the data.

i've found this solution which works for a single file, but i need the function to iterate multiple times though different files. i've included the code below that works for a single file.

<span id="placeholder"></span>
<script>
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function() {
        if (xhr.readyState == 4 && xhr.status == 200) {
            document.getElementById('placeholder').innerHTML = xhr.responseText;
        }
    }
    xhr.open('GET', 'test.txt');
    xhr.send();
</script>

0 Answers0