mardi 28 août 2018

Simply calling one JS function from another is not working

I have a ridiculously simple HTML document and JS file and I cannot figure out why this simple code is not working.

Here's the index.html:

<!DOCTYPE HTML>
<html>
    <head>
        <script src="scripts/ServerStatus.js"></script>
    </head>
    <body>
        <script>getStatus();</script>
    </body>
</html>

Here's ServerStatus.js:

function getStatus() {
    alert('Test 1');
    isOnline();
    alert('Test 3');
}

function isOnline() {
    alert('Test 2');
}

It only displays the "Test 1" alert, and then nothing. If I remove the isOnline() function call, it will display the "Test 1" alert followed by the "Test 3" alert without issues. Why is the function call causing the execution to just exit like that?




Aucun commentaire:

Enregistrer un commentaire