It is not recommended to read configuration files from JavaScript. Instead, you can do this:
- Read the file on the server side (using PHP, .Net or Python or any other language that you prefer)
Display valid JavaScript values. Sort of:
var maxTime = "<?php echo maxTime; ?>";
var upVotePostMaxTime = "<?php echo upVotePostMaxTime; ?>";
where <?php echo maxTime; ?> <?php echo maxTime; ?> and <?php echo upVotePostMaxTime; ?> <?php echo upVotePostMaxTime; ?> will matter 60 each. This will be displayed on the client side as:
var maxTime = "60"; var upVotePostMaxTime = "60";
and then you can use it in javascript.
Values ββare assigned in double quotation marks to prevent JavaScript from breaking if null values ββare sent from the server.
Verify that the JavaScript values ββare set to the correct values.
source share