caixa de pesquisa simples

by Felype Rennan

HTML

<div class="pesquisa fancy">
    <input id="campo_pesquisar" placeholder="Search..." />
    <button id="bt_pesquisar"></button>
</div>

CSS

.pesquisa.fancy {
    padding: 18px 22px;
    background-color: #eee;
    position: relative;
    height: 50px;
    border-radius: 8px;
}
.pesquisa.fancy > input {
    position: absolute;
    left:22px;
    top: 20px;
    height: 40px;
    padding: 0;      
    font-size: 26px;
    font-family: 'Segoe UI';
    width: 89%;
    background: transparent;
    border: 1px solid transparent;
    outline: none !important;
    color: #666;
}
.pesquisa.fancy > button {
    position:absolute;
    cursor: pointer;
    right: 20px;
    top: 20px;
    width: 40px;
    height: 40px;
    outline: none;
    border: 1px solid transparent;
    background-color: transparent;
    background-image: url('http://www.stryk.es/m/images/search.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

JavaScript

$('#bt_pesquisar').click(function(e) {
    $.ajax({
      url: "/Url/Backend/Pesquisa?q="+$('#campo_pesquisar').text()
    }).done(function(data) {
        console.log(data);
    });
});