I need to know how i get my PHP variable into JavaScript as a text. I will show you my code:
<script type="text/javascript">
$('#krasvak').wScratchPad({
scratchMove: function (e, percent) {
console.log(percent);
if (percent > 70)
{
this.clear();
window.alert("U heeft uw code gekrast");
window.location.href='compleet.php'; <!-- locatie waar je heen gaat na het krassen-->
}
}
});
$('#krasvak').wScratchPad('bg', 'HERE MUST THE VARIABLE COME '); <!-- de onderste laag die vrijkomt-->
$('#krasvak').wScratchPad('fg', 'images/overlay.png'); <!-- de laag die je weg krast-->
$('#krasvak').wScratchPad('size', 15);
$('#krasvak').wScratchPad('cursor', 'url("./images/coin.png") 5 5, default'); <!-- de muis in het krasgebied -->
</script>
<?php
$_COOKIE["number"];
if ($_COOKIE["number"] < 5000)
{
$achtergrond = 'images/slide1.png';
}
else
{
$achtergrond = 'images/logo.jpg';
}
?>
It is about the bg that is not empty.