Used below code to get value from data-key and join with .html.
Initial Url will be - http://www.test.com/en/location/london.html
Based on key value (Ex:258888) collected need to append inside url like http://www.test.com/en/location/london.258888.html
But, now it gets latest URL and including new key if user choose next option value. On each choose value, it includes to URL.
Like - http://www.test.com/en/location/london.258888.3899091.html
But, it have to be only.
http://www.test.com/en/location/london.3899091.html
$('a.dropdown-item').on('click', function(){
let getDataKey = $(this).attr('data-key');
let getWindowLocation = window.location.href;
let getLocationVal = getWindowLocation.replace(/\.html/, '.' + getDataKey + '.html');
window.location.replace(getLocationVal);
});