var dist = parseInt("<?php echo json_encode($distance); ?>");
Here is Solutions:
We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.
$distance is an integer? why don’t you just write
var dist = <?php echo $distance; ?>
If the value in $distance is just an integer, you don’t need the json_encode call. You can just do a php echo of $distance.
var dist = <?php echo $distance; ?>;
if you right click > view html source in your web browser, you would see for yourself that you have an extra set of quotes.
Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂