Forum Discussion
MarkSetlock-b41
4 years agoCommunity Member
What other information can be accessed from the LMS API using JavaScript
Hoping the community can help me figure this out. I am currently using this JavaScript to retrieve the learner's name from the LMS:
var lmsAPI = parent; var name = lmsAPI.GetStudentName(); var n...
JamesMartin-49f
3 years agoCommunity Member
All I've found you can pull (assuming you publish to some version of SCORM) is student name, as you've demonstrated. I'd really, like to be able to pull course title and student email address. But I haven't found a way to do it.
Here's my more verbose way of doing student first name and last name:
// Only works if published via SCORM
if (typeof lmsAPI != "undefined") {
var LMSName = lmsAPI.GetStudentName();
var nameArray = LMSName.split(',');
var lastName = nameArray[0];
var firstName = nameArray[1].trim();
var fullName = firstName + ' ' + lastName;
console.log('Published via SCORM: lmsAPI is available');
console.log('fullName: ' + fullName);
console.log('learnerEmail: ' + learnerEmail);
} else {
console.log('lmsAPI does not exist. Did you publish as xAPI?')
}