Retrieve student preference language through javascript from the LMS

Sep 13, 2020

Hi I am trying to retrieve the preferred language from the LMS for a user. I can retrieve studentID studentName and other attributes using javascript. No matter how I try I can't fetch the preferred language. It is always returning an empty string. Below is my code and I am using Moodle. Any help would be appreciated:

 

function Script1()
{
var player = GetPlayer();
function findLMSAPI(win) {
if (win.hasOwnProperty("GetStudentID")) return win;
else if (win.parent == win) return null;
else return findLMSAPI(win.parent);
}
var lmsAPI = findLMSAPI(this);
var myName = lmsAPI.SCORM_GetLanguagePreference();
player.SetVar("newName", myName);

}

Be the first to reply

This discussion is closed. You can start a new discussion or contact Articulate Support.