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

300
Visualizações
jQuery autocomplete ui with json issue

I'm trying to get the jquery autocomplete ui to work but without success. There is no list of matches presented. I'm getting the error "TypeError: this.source is not a function"

so far I have an input field <input type="text" id="searchbar" name="title" placeholder="Search">

and then in my script I have

I'm not getting this to work. anyone have any ideas of where I can begin to troubleshoot? I really have a hard time with the jquery ui documentation.

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

At first console.log your data to check is there any data returned from ajax request then remove double quote from your data variable.

 source: "data"(wrong)
 source: data(right)

wish it helps

over 4 years ago · Santiago Trujillo Relatório

0

You only have to use this code for your autocomplete:

$("#searchbar").autocomplete({
    source: "php/searchbar.php",
    minLength: 3
});

You don't have to do an extra ajax request. The plugin it self does the ajax request.

You have an missing hash in your autocomplete selector too:
$("searchbar") vs. $("#searchbar")

I have created a jsfiddle here: https://jsfiddle.net/9rtu412g/

Source from documentation here: https://jqueryui.com/autocomplete/#remote (view source)

For your jQuery version:
<script src="js/jquery-1.6.js" type="text/javascript"></script>

Use this jQuery UI version: https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js

I hope I could help you to solve your problem.

over 4 years ago · Santiago Trujillo 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