I want the JavaScript variable res
value in a PHP variable. I have tried sending the value into a hidden field but it does not work. How can i get the value so that it can be used in PHP?
<script type="text/javascript">
(function () {
setTimeout(function () {
H5P.externalDispatcher.on('xAPI', function (event) {
if (event.data.statement.result.response == undefined && event.data.statement.result.completion == true) {
alert("Topic has been completed");
res = 1;
}
});
}, 1000)
})();
</script>