diff --git a/app/assets/javascripts/exhibit_search_typeahead.js b/app/assets/javascripts/exhibit_search_typeahead.js index b05338e8..0f768c7e 100644 --- a/app/assets/javascripts/exhibit_search_typeahead.js +++ b/app/assets/javascripts/exhibit_search_typeahead.js @@ -16,7 +16,8 @@ var container = el.parents('.exhibit-search-typeahead'); _this.typeaheadElement = el; _this.form = el.parents('form'); - _this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + '?q=%QUERY'; + const separator = el.data().typeaheadRemoteUrl.includes('?') ? '&' : '?'; + _this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + `${separator}q=%QUERY`; _this.preventFormSubmitOnTypeahead(); // Cleanup typeahead if it alread exists (e.g. back-button cache) diff --git a/app/assets/javascripts/index_status_typeahead.js b/app/assets/javascripts/index_status_typeahead.js index 5dea026f..907485da 100644 --- a/app/assets/javascripts/index_status_typeahead.js +++ b/app/assets/javascripts/index_status_typeahead.js @@ -17,7 +17,8 @@ init: function (el) { var _this = this; _this.itemStatusRemoteUrl = el.data().typeaheadRemoteUrl; - _this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + '?q=%QUERY'; + const separator = el.data().typeaheadRemoteUrl.includes('?') ? '&' : '?'; + _this.typeaheadRemoteUrl = el.data().typeaheadRemoteUrl + `${separator}q=%QUERY`; el.typeahead(_this.typeaheadOptions, _this.typeaheadSources()); el.bind('typeahead:selected', function(e, suggestion) {