Copy link to clipboard
Copied
I have hit a stop on the ComonJS interface (window.cpAPIInterface.setVariableValue), and what should be relatively simple, I'm having difficulties with. I can't get the name to render. This is what I have:
In my Captivate published HTML file, in the <head> section, I set the following variable "learner", and define the function setLearnerName() function as:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script src="standard.js" type="text/javascript"></script><script>
<script>
var learner = "MyName;
function setLearnerName(){
window.cpAPIInterface.setVariableValue("learner_name", learner);
}
</script>
</head>
In my Captivate file in the Script Window, I simply call the function: "setLearnerName();" and do nothing else.
Yet, when I run on my server the published version, the output is blank, and not "MyName".
Can anyone advise me on what to do to get the variable set in the HTML file to that of the Captivate Caption output? I used this article as a reference: Common JS interface
Thanks for your time.
Bibi
Copy link to clipboard
Copied
You're missing a closing quote setting "learner":
var learner = "MyName";