I am trying to redirect from javascript autocomplete search bar element.
Search field works perfectly except one thing. if i was in www.example.com/foo then click a data from search bar. Its redirects me to kinda this pages: the www.example.com/news/1
When i try searchbar again. And click products data from search bar. Its redirect me to the www.example.com/news/products/1
But i want to www.example.com/products/1
"/news" must go away.
if(window.location.pathname.split("/")[1] === "news"){
window.location.hostname.href ="?tab=" +ui.item.category_id+"&id="+ui.item.id;
}
else
window.location.href ="products?tab=" +ui.item.category_id+"&id="+ui.item.id;
window.location.hostname.href
didn't worked for me? How can i use clean link then add like "/products/ui.item.id"
my brief is i can't redirect (href) clean route.