I'm working on a project for class, and I'm pretty much an absolute beginner at this sort of thing. I have a server running on Ubuntu. Inside script.js I have
$(document).ready(function(){
$.get('/var/www/html/hadoopstatus.txt', function(response) {
var $hadoopstatus = response;
}, "text");
if ($hadoopstatus == 'Running'){
document.getElementById('b2').disabled = false;
}
if ($hadoopstatus == 'Stopped'){
document.getElementById('b1').disabled = false;
}
});
And inside index.html I have
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script src="script.js"></script>
// some stuff
</head>
<body>
// stuff
<form method="post">
<button type="submit" id="b1" disabled>Start Hadoop</button>
<button type="submit" id="b2" disabled>Stop Hadoop</button>
</form>
// stuff
</body>
/var/www/html/hadoopstatus.txt contains only
Running
The problem I'm having is that the buttons, in this case the button "Stop Hadoop", will not enable. What am I doing wrong?