Updating a Sophie Variable Within a Script

20 views
Skip to first unread message

Ramazan Kizilyildirim

unread,
Oct 6, 2020, 5:26:59 AM10/6/20
to SoPHIE Community
I am coding a ball catching game in JS. At each ball catch I need to update the score of my subject. I think I have to send a request to Ajax to run the code and make the update but it is not clear how to create and send the request and how to handle the request on the Ajaxc side. I would appreciate any help. I put below the a simple part of the code for currently what I am doing which doesnt solve my problem.

<script>
if(ballCatch==true){
$increment=$variableApi->getPE('score')+1;

"<?php $variableApi->setPE('score', $increment);?>"';
}
<script>
Reply all
Reply to author
Forward
0 new messages