@@ -141,22 +141,25 @@ export default class RunestoneBase {
141141 data . sid = this . sid ;
142142 }
143143 if ( ! eBookConfig . practice_mode && this . assessmentTaken ) {
144- jQuery
145- . getJSON (
146- eBookConfig . ajaxURL + "getAssessResults" ,
147- data ,
148- // defined in in RunestoneBase
149- this . repopulateFromStorage . bind ( this )
150- )
151- . fail (
152- function ( ) {
153- try {
154- this . checkLocalStorage ( ) ;
155- } catch ( err ) {
156- console . log ( err ) ;
157- }
158- } . bind ( this )
159- ) ;
144+ let request = new Request (
145+ eBookConfig . ajaxURL + "getAssessResults" ,
146+ {
147+ method : "POST" ,
148+ body : JSON . stringify ( data ) ,
149+ headers : this . jsonHeaders ,
150+ }
151+ ) ;
152+ try {
153+ let response = await fetch ( request ) ;
154+ let data = await response . json ( ) ;
155+ this . repopulateFromStorage ( data ) ;
156+ } catch ( err ) {
157+ try {
158+ this . checkLocalStorage ( ) ;
159+ } catch ( err ) {
160+ console . log ( err ) ;
161+ }
162+ }
160163 } else {
161164 this . loadData ( { } ) ;
162165 }
@@ -180,7 +183,7 @@ export default class RunestoneBase {
180183 * @param {* } status - the http status
181184 * @param {* } whatever - ignored
182185 */
183- repopulateFromStorage ( data , status , whatever ) {
186+ repopulateFromStorage ( data ) {
184187 // decide whether to use the server's answer (if there is one) or to load from storage
185188 if ( data !== null && this . shouldUseServer ( data ) ) {
186189 this . restoreAnswers ( data ) ;
0 commit comments