I am trying to encode an ampersand using EncodeURIComponent and replace it with %26. The issue I am having is when I go to decode it using DecodeURIComponent it is displaying an "and". Here is my code. Anyone have any ideas what i am doing wrong?
if(e.keyCode == 13){
var searchtab = getSearchParam($(this).parent().find(".search-tpe").val());
$(this).val($(this).val().replace(/Search topic, title, author, A53/, ''));
window.location = "/search/fullsite-search.html?query=" + decodeURIComponent(encodeURIComponent($(this).val().replace(/\\/g, '').replac\
e(/&/g,'%26'))) + "&" + getSearchParam($(this).parent().find(".search-type").val());
}