I've found some questions/answers but they were all pretty dated, so I wanted to ask and see if there's some new practices/meta.
I've got this web-page I'm working now, atm its only front page and its build on html, css and javascript. I'm building in Laravel because soon I'll be implementing a database for the forms, users, documents a few other things.
Anyway, I wanted a simple search engine(one that only searches through the different pages, for example, kind of like facebook's search)
So after thinking and digging for a while, this is the solution I'm currently working on:
HTML:
<ul class="navbar-nav ml-1 mr-5">
<form class="form-inline" id="procurahead">
<input class="form-control espaco_procura" type="text" list="listhead" placeholder="Pesquisa" aria-label="Search" id="txtinputhead" autocomplete="off">
<datalist id="listhead">
<!-- THEMES -->
<option value="foo">
<option value="foo1">
<option value="foo2">
<option value="foo3">
<option value="etc">
</datalist>
<button class="btn btn-outline-success btnprocura" type="submit"><i class="material-icons procura">search</i></button>
</form>
</ul>
JAVASCRIPT:
$('#procurahead').submit(function(event){
event.preventDefault();
var input1 = $('#txtinputhead').val();
if(input1 == "foo"){
window.location.href = 'http://localhost/laravel/l55/public/foo';
}
if(input1 == "foo1"){
window.location.href = 'http://localhost/laravel/l55/public/foo1';
}
if(input1 == "foo2"){
window.location.href = 'http://localhost/laravel/l55/public/foo2';
}
if(input1 == "foo3"){
window.location.href = 'http://localhost/laravel/l55/public/foo3';
}
if(input1 == "etc"){
window.location.href = 'http://localhost/laravel/l55/public/etc';
}
});
So, This is working pretty well while I don't have a lot of pages, but I figure that if I expand to all of web pages then I'll be pretty long and seemingly there should be some simpler way to do it.
So the question is: Is there any better/simpler way to implement this?
Thanks in advance!