Passing variables via JavaScript Triggers & PHP

Jun 03, 2015

Afternoon all

For the life of me i cant work out what ime doing wrong?

I have created a PHP file and csv file data can written and appended between the two so the PHP is fine,

But i cannot get the javascript trigger to work when firing it out of articulate player to the php which then writes the variables (in theory stored in storyline to the csv file)

any ideas?


*don't worry about the linking location just trying to get the concept working for a questionnaire ,.

Trigger javascript.

var player = GetPlayer();

var name = player.GetVar("name")
var rating = player.GetVar("rating")
var comment = player.GetVar("comments")

window.location.href = ""= + name + "&w2=" + rating + "&w3=" + comments;


Many thanks all.

2 Replies
Bruce Holliday

Mmmm, good ole SL and getting at variables.... 

1. Are you able to display the variables inside of SL?
2. In an Alert?
3. In an external page - as in a certificate for example?

Looks good to me but hows about skinning the cat with this. Write it to a temp file, scrape it off with php and use it?

var fso = new ActiveXObject("Scripting.FileSystemObject");
var s = fso.OpenTextFile("C:\\Test.txt", 8, true, 0);
var mot1 = player.GetVar("mot1");
var mot2 = player.GetVar("mot2");
s.WriteLine("Email: " + mot1);
s.WriteLine("Name: " + mot2);

or write a html page and scrape that with php?

See the attached image for code, it was blocked from pasting. Hope that helps.

Alex Stanton

It does indeed thank you hadn't thought of taking the extra step, 

 Sadly no to alerts /emails  the goal is to collect responses from a questionnaire that branches uses sliders and so on, 

 I have  however solved this finally and have i think got a semi foolproof way of sending these.  i will put a screener up in a day or two  with a breakdown as its a quite simple thing to replicate now i have solved the main issue.  (well bypassed it) 

with a tear in my eye " a poor man's lms is born" 



This discussion is closed. You can start a new discussion or contact Articulate Support.