diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 9bd28f1..2345944 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -254,8 +254,18 @@ if (element_settings.dialog) { ajax.options.data.dialogOptions = element_settings.dialog; } + if (element_settings.dialogType) { - ajax.options.url += '?dialogType=' + element_settings.dialogType; + var query_parameters_prefix = ''; + // Ensure that we have a valid URL by adding ? when no query parameter is + // yet available, otherwise append using &. + if (ajax.options.url.indexOf('?') === -1) { + query_parameters_prefix = '?'; + } + else { + query_parameters_prefix = '&'; + } + ajax.options.url += query_parameters_prefix + 'dialogType=' + element_settings.dialogType; } // Bind the ajaxSubmit function to the element event.