On the site we implement the function of switching languages. To make the link, for example, /site.com/ en /index.html, we switched to /site.com/ en /index.html? I just can not understand the logic of extrusion and substitution. Now the code is:
$('.language-select li').click(function(){ var setLang = $('.language-select').data('location'), dataLangSelect = $(this).data('lang'); $('.language-select').data('location', dataLangSelect); $('.language-select li').removeClass('active'); $(this).toggleClass('active'); if($(this).hasClass('active')){ if(dataLangSelect == 'ua') { window.location = '/ua/'; } if(dataLangSelect == 'ru') { window.location = '/ru/'; } if(dataLangSelect == 'en') { window.location = '/en/'; } } })