Forum Discussion
Exporting Variables into a Google Spreadsheet
(2/2) There are a couple of ways to run submission. The first is pretty simple and doesn't require JQuery. This creates an invisible iframe and submits using that iFrame. This works pretty consistently for me. Since we aren't looking for any return to the AJAX call, this is probably lighter weight than the JQuery version.
var player=GetPlayer();
var questionID = player.GetVar("team");
var choice =player.GetVar("choice");
var questionID=player.GetVar("qRef");
var category=player.GetVar("category");
var formEvent=player.GetVar("formEvent"); //I put the URL listed under step 3 in the first part of this post into a Storyline variable.
var region=player.GetVar("region");
var role=player.GetVar("role");
var goURL=formEvent+"?entry.439953588="+username+"&entry.1756523096="+category+"&entry.1042712636="+questionID+"&entry.769939824="+choice+"&entry.771181539="+region+"&entry.818358780="+role;
if(document.getElementById('sendGoogle')){
var elem = document.getElementById("sendGoogle");
elem.parentElement.removeChild(elem);
}
ifrm = document.createElement("IFRAME");
ifrm.setAttribute("src", goURL);
ifrm.id="sendGoogle";
ifrm.style.visibility = "hidden";
document.body.appendChild(ifrm);