I am developing a simple web application. I have a MySQL database which stores a value. When I load my website, I want to run a php script that retrieves said value from the DB and passes it to javascript. I then use the javascript to either disable a button or not.
In my index.html:
<form action="someOtherScript.php" method="get">
<input type="submit" name="button1" value="Run me now!">
</form>
<script>
var value = "<?php echo $someVar; ?>";
if(value == 0){
document.getElementsByName("button1")[0].disabled = true;
}
</script>
In my getValueFromDB.php:
<?php
<!-- retrieve value from DB here (This part is not the problem)-->
$someVar = 0;
?>
How can I tell my javascript in the index.html which php script to use (I have multiple)? So when the website loads I want my javascript to get the result from the getValueFromDB.php script.
Thanks a lot!