Forum Discussion
ElizabethDen054
9 years agoCommunity Member
Thanks, Mark. I appriciate your help, I'm going to take a stab at this again today.
Here's my code, maybe you (or anyone) can see where I messed up.
var head = document.getElementsByTagName('head')[0];
var script = document.createElement('script');
script.src = '//code.jquery.com/jquery-1.11.0.min.js';
script.type = 'text/javascript'; head.appendChild(script)
var player = GetPlayer();
//PLACE YOUR WEB APP URL
WEB_APP_URL = "https://script.google.com/macros/s/AKfycbxXSFh5w8DgeUEwKOcTsT9WgguerXFK9STcLyCEX26l85BovKI/exec";
// STORE ARTICULATE STORYLINE VARIABLES
// "Columnname_Google_Spreadsheet" : player.GetVar("Name_Storyline_Variable")
// ATTENTION: Use a comma if you use multiple Storyline variables storyline =
{
"date" : new Date().toJSON().slice(0,10), //STORE DATE "LearnerUNID" : player.GetVar("LearnerUNID"),
"LearnerLastName" : player.GetVar("LearnerLastName"), "LearnerFirstName" : player.GetVar("LearnerFirstName"), "PreviouslyUsed" : player.GetVar("PreviouslyUsed"),
"PreviousLocation" : player.GetVar("PreviousLocation"), "NumberOfMonths" : player.GetVar("NumberOfMonths"), "ResultsPreReq.ScorePercent" : player.GetVar("ResultsPreReq.ScorePercent"),
"GivenAccessToTestOut" : player.GetVar("GivenAccessToTestOut")
}
//DELAY SO JQUERY LIBRARY IS LOADED
setTimeout(function (){
//Export to Google
$.ajax({
url: WEB_APP_URL,
type: "POST",
data : storyline,
success: function(data)
{
console.log(data);
},
error: function(err) {
console.log('Error:', err);
}
});
return false;
},
1000);
I'm more familiar with HTML than I am with Javasript, so it's very possible my code the issue.
I used your template and replaced only the top KEY (line #2) with my spreadsheet key.
I have two that came back as all "undefined" and one didn't feed information at all to the spreadsheet.
Thanks again for your help.