Items API Methods
save()
Saves the learner session responses into the Learnosity database.
You would want to use this method because it is essential to record the learners responses to the assessment Questions. For example, you may want to save the learners' responses manually when they navigate to the next section of the assessment.
The saveSettings
argument provides a way to define specific callbacks for events related to the save operation. It is recommended to configure this argument to handle additional logic when the save operation completes successfully and also allows you to gracefully handle any error states.
Note To easily save assessments at pre-determined time intervals, refer to the auto_save
initialization option and its properties.
Examples
var saveSettings = {
// Receives an array of response_ids (strings) of the saved session responses
success: function (response_ids) {
console.log("Save was successful", response_ids);
},
// Allows you to immediately handle a save error event
error: function (event) {
console.log("Save has failed", event);
},
// Capture the progress of the current submit operation
progress: function (event) {
console.log("Current progress", event);
// The event object provides additional progress information, e.g.
/*
{
state: 'saving',
percentage: 50,
bytesTotal: 1234,
bytesUploaded: 567
}
*/
}
};
itemsApp.save(saveSettings);
Arguments
-
saveSettings object
-
success function
Function called on a successful save.
-
error function
Function called when an error occurs while saving.
-
progress function
Reports on the status of the save operation while it is in progress.
-
Return value
None (undefined
).
Caveats
Calling the save
method while using the "local_practice"
session type is not supported. See Online Submission Versus Local Only for more information.
Related articles
- The
submit()
method, the method used to submit the current assessment. - The
safeToUnload()
method, the method used to check if the current session has been saved successfully. - The
auto_save
initialization option, the option used to configure the automatic saving of the assessment.