h5p-editor-php-library
h5p-editor-php-library copied to clipboard
h5peditor-init.js file getAjaxUrl method is missing the ? for query parameters
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 = '&'; } } }
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 ? '?' : '&'
I made the pull request here: #51
Hopefully I got it right, was my first pull request.