Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

302
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda