Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

137
Visualizações
live search add a href to results

I have a live search in laravel 7 everything works good but I cant add (href a tag) to result list because result show in select option (select2 library) without (a) tag and cant be open in a new page for see result for this keyword

my blade:

   <div class="fre-search-wrap">
      <select class="livesearch form-control" name="Find Consultants"></select>
   </div>

my scripst:

<script type="text/javascript">
$('.livesearch').select2({
    placeholder: 'Select Consultants',
    ajax: {
        url: '/live_search/action',
        dataType: 'json',
        delay: 550,
        processResults: function (data) {
            return {
                results: $.map(data, function (item) {
                    return {
                        text: item.title,
                        id: item.id
                    }
                })
            };
        },
        cache: true
    }
});

the main source was this https://www.positronx.io/laravel-autocomplete-search-with-select2-example/

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Hello guy you can use this to add a tag:


$('.livesearch').select2({
    placeholder: 'Select Consultants',
    ajax: {
        url: '/live_search/action',
        dataType: 'json',
        delay: 550,
        processResults: function (data) {
            return {
                results: $.map(data, function (item) {
                    return {
                        text: ""+item.title+"", // a tag
                        id: item.id
                    }
                })
            };
        },
        cache: true
    }
});
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda