<script src="example"></script>
<script>
var $id = '<?php echo $id; ?>';
var $linkAmount = '<?php echo $linkAmount; ?>';
var $actionAmount = '<?php echo $actionAmount; ?>';
var $deliverLink1 = '<?php echo $deliverLink1; ?>';
var $deliverLink2 = '<?php echo $deliverLink2; ?>';
var $deliverFlink = '<?php echo $deliverFlink; ?>';
var $id = '<?php echo $id; ?>';
var $uid = '<?php echo $uid; ?>';
</script>
Till now I used this way, to fetch variables via html and then I used them in my external js file. But first, I don't want to have this in my html file, and also I don`t want that people can see the $uid of other people in the html and the deliverflink.
$stmt = $conn->prepare('SELECT userid, action, action1, link1, action2, link2, action3, link3, action4, link4, faction, flink, actionAmount, linkAmount FROM link WHERE id = ?');
$stmt->bind_param('s', $id);
$stmt->execute();
$stmt->bind_result($uid, $action, $action1, $link1, $action2, $link2, $action3, $link3, $action4, $link4, $faction, $flink, $actionAmount, $linkAmount);
$stmt->fetch();
$stmt->close();
Also this is my php script. So I WANT, that I can fetch the value of the php variables directly in the .js file