Forum Discussion

SimonPetersen's avatar
SimonPetersen
Community Member
11 months ago

Issues using JavaScript to send Quiz Results to PHP script

Hi all,

So I'm at a point, where I really cannot find the solution.

I have a JavaScript trigger, which should send the scorepoints to my MySQL database:

The PHP script send.php is capturing the userId and quizId correctly, but score output is null.

When I use static values, it works completely fine:

I think I can narrow down the issue with the score variable. I have checked and double checked the variable is correct:

So is it this part that is incorrect, or is there something else I'm missing here?

  • SteveGannon's avatar
    SteveGannon
    Community Member

    You won't be able to pull an internal Storyline variable into JavaScript. Instead, create a custom variable and assign it the value of Quiz1.ScorePoints using a trigger. Then use JavaScript to get the custom variable. Should work.

    • SimonPetersen's avatar
      SimonPetersen
      Community Member

      Thanks Steve, that worked like a charm. Thank you so much.

      For reference: