Forum Discussion
ToddHaynes-40dc
8 months agoCommunity Member
Javascript code for LMSCommit() SCORM 2004
I would like to submit a LMSCommit() command using JavaScript. Can anyone help me with the syntax? Which of the options for //submit data to LMS is best practice for SCORM 2004 version 4?
// conne...
JohnCooper-be3c
8 months agoCommunity Member
Hi Todd,
Andrew is correct, the syntax for the commit statement is:
lmsAPI.Commit();
The Commit method typically takes an empty string as an argument and returns a boolean value "true" or "false" indicating whether the commit to the LMS was successful.
You might want to consider just checking the Commit was successful:
var commitSuccess = lmsAPI.Commit();
if (commitSuccess !== "true") {
console.error("Failed to commit changes to the LMS");
}