ContentAPI

When utilizing the content API syntax is key

With dominKnow | ONE you can access a variety of functions through the contentAPI and utilize them in your HTML widgets. When using them them, syntax is key.

The basic format can be seen below:

For getting and setting variables

//Where thevariablename is the name of a custom variable declared in your dominKnow | ONE project.
parent.contentApi.getData('thevariablename');

//Where tempVar is a JavasScript value to which you are setting the dominKnow | ONE variable.
parent.contentApi.setData('thevariablename',tempVar);


Calling a contentAPI action that gets the studentID

//Where studentID is the name of a custom variable declared in your dominKnow | ONE project.
var studentID = parent.contentApi.getUserID ();

Calling a contentAPI action that gets the studentName

//Where studentName is the name of a custom variable declared in your dominKnow | ONE project.
var studentName = parent.contentApi.getStudentName ();


General JavaScript Hints

It's often useful to see what is going on in a script. You can send information to the Browser's log (which you can see in advanced settings - JavaScript Console) so you know if the script is working.

For example in the studentName case you could report the value to the console log when testing with the following JavaScript command.

console.log ("student is " + studentName);