h5p-editor-php-library icon indicating copy to clipboard operation
h5p-editor-php-library copied to clipboard

h5peditor-init.js file getAjaxUrl method is missing the ? for query parameters

Open MiikaL opened this issue 6 years ago • 2 comments

In the file h5peditor-init.js, with the method getAjaxUrl where is constructs the query url, I think its missing the addition of the "?" to make it a valid url.

I would change this: if (parameters !== undefined) { for (var property in parameters) { if (parameters.hasOwnProperty(property)) { url += '&' + property + '=' + parameters[property]; } } }

to this: if (parameters !== undefined) { var separator = '?'; for (var property in parameters) { if (parameters.hasOwnProperty(property)) { url += separator + property + '=' + parameters[property]; separator = '&'; } } }

MiikaL avatar Mar 09 '18 12:03 MiikaL

Could you create a Pull Request for this? Also, note that the ? may already be in the ajaxPath, so you may want to do a ajaxPath.indexOf('?') === -1 ? '?' : '&'

icc avatar Mar 22 '18 14:03 icc

I made the pull request here: #51

Hopefully I got it right, was my first pull request.

MiikaL avatar Mar 27 '18 08:03 MiikaL