diff --git a/lms/static/js/courseware/bridge.js b/lms/static/js/courseware/bridge.js index f8bad71a20c8..c988ceec76d5 100644 --- a/lms/static/js/courseware/bridge.js +++ b/lms/static/js/courseware/bridge.js @@ -44,7 +44,7 @@ function markProblemCompleted(message) { data.split("&").forEach(function (item) { const [inputId, answer] = item.split('=', 2); - problemContainer.find('input[id$="' + answer + '"], input[id$="' + inputId + '"]').each(function () { + problemContainer.find(`input[id$="${answer}"], input[id$="${inputId}"]`).each(function () { this.disabled = true; if (this.type === "checkbox" || this.type === "radio") { this.checked = true; @@ -56,14 +56,14 @@ function markProblemCompleted(message) { } /** - * Overrides the default $.ajax function to intercept the requests to the "problem_check" endpoint - * and send the data to the native mobile apps. + * Overrides the default $.ajax function to intercept the requests to the "handler/xmodule_handler/problem_check" + * endpoint and send the data to the native mobile apps. * * @param {Object} options The data object for the ajax request */ const originalAjax = $.ajax; $.ajax = function (options) { - if (options.url && options.url.endsWith("problem_check")) { + if (options.url && options.url.endsWith("handler/xmodule_handler/problem_check")) { sendMessageToIOS(JSON.stringify(options)); sendMessageToAndroid(JSON.stringify(options)); } diff --git a/lms/static/js/spec/courseware/bridge_spec.js b/lms/static/js/spec/courseware/bridge_spec.js index c30d64e999a9..4cd907802e69 100644 --- a/lms/static/js/spec/courseware/bridge_spec.js +++ b/lms/static/js/spec/courseware/bridge_spec.js @@ -70,7 +70,7 @@ describe('JS bridge for communication between native mobile apps and the xblock' it('should intercept the request to problem_check and send data to the native apps', function() { const ajaxOptions = { - url: 'http://example.com/problem_check', + url: 'http://example.com/handler/xmodule_handler/problem_check', data: {answer: 'test'} }; @@ -82,7 +82,7 @@ describe('JS bridge for communication between native mobile apps and the xblock' it('should call the original $.ajax function', function() { const ajaxOptions = { - url: 'http://example.com/problem_check', + url: 'http://example.com/handler/xmodule_handler/problem_check', data: {answer: 'test'} };