Forum Discussion
AliciaSummers
13 years agoCommunity Member
Send results slide via email using Javascript ??
Hello! I'm pretty new to... well... all of this, but I'm a fast learner. I've been toying around with adding Javascript to my Storyline project for some advanced capabilities, and so far I've fig...
JacekChrabąszcz
12 years agoCommunity Member
Hello,
You can simply send emails joining JavaScript and PHP, e.g. in Execute JavaScript put a simple script
var player = GetPlayer();
$.ajax({
url: "quiz.php",
type: "POST",
data: {"student" :player.GetVar("student"), "score":player.GetVar("score")},
success: function(data)
{
alert("Success" + data);
}
});
In the folder with story_html5.story you can add -let's say- quiz.php:
<?php
$message .= 'Hello!' . "\r\n\r\n";
$message .= 'Student: ' . $_POST['student'] . "\r\n\r\n";
$message .= 'Score: ' . $_POST['score'];
mail("your@address.com","Quiz 1", $message);
?>
And you will receive an email:
Subject: Quiz 1
Hello!
Student: e.g. John Doe
Score: e.g. 21
Of course you can add many variables from Storyline in your $message.
Best regards
Jacek