Algolia Redirect To Search Results
I'm having problem with redirecting search results to page that I want to display results. Want to have search bar in header so that my results are displayed on results page or som
Solution 1:
Redirecting users to a page in JavaScript is as easy as doing
window.location = 'your_url_here'
If you're just looking to redirect to a /search?q=query
page when the user types Enter, that's as easy as wrapping the input you're using inside a form.
<form action="/search" method="GET">
<input type="search"id="your-input" name="q" />
</form>
If you want to redirect to an item page, the typeahead:select
event gives you the selected option :
$('#your-input')
.typeahead(/* ... */)
.on('typeahead:select', function (e, suggestion) {
window.location = suggestion.url;
});
Post a Comment for "Algolia Redirect To Search Results"