From fba8badf1a303329b9498c3e06ea7da535e21b60 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 20 Apr 2015 10:30:52 +0200 Subject: [PATCH] Use URL template to support URLs of different formatting. --- js/h5p.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/h5p.js b/js/h5p.js index f8efddb..42b28f9 100644 --- a/js/h5p.js +++ b/js/h5p.js @@ -1562,7 +1562,7 @@ H5P.createTitle = function(rawTitle, maxLength) { */ function contentUserDataAjax(contentId, dataType, subContentId, done, data, preload, invalidate, async) { var options = { - url: H5PIntegration.ajaxPath + 'content-user-data/' + contentId + '/' + dataType + '/' + (subContentId ? subContentId : 0), + url: H5PIntegration.ajax.contentUserData.replace(':contentId', contentId).replace(':dataType', dataType).replace(':subContentId', subContentId ? subContentId : 0), dataType: 'json', async: async === undefined ? true : async }; @@ -1680,7 +1680,7 @@ H5P.createTitle = function(rawTitle, maxLength) { data = JSON.stringify(data); } catch (err) { - if (options.errorCallback) { + if (options.errorCallback) { options.errorCallback(err); } return; // Failed to serialize. @@ -1747,7 +1747,7 @@ H5P.createTitle = function(rawTitle, maxLength) { if (state !== undefined) { // Async is not used to prevent the request from being cancelled. H5P.setUserData(instance.contentId, 'state', state, {deleteOnChange: true, async: false}); - + } } }