Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

182
Views
obtener imágenes de ajax y mostrarlas en select2

Estoy tratando de mostrar imágenes, junto con el nombre y la identificación de una base de datos y mostrarlas en un menú desplegable select2. Veo en la consola que los objetos están llegando, pero no los muestran.

Gracias por tu ayuda.

 <select style="width: 100%" id="organization" class="form-control" name="organization-id"> <option value="" disabled selected>Find an organization</option> </select> function formatData (data) { if (!data.id) { return data.name; } var $result= $( '<span><img src='+ data.avatar +'/> ' + data.name + '</span>' ); return $result; }; $( "#organization" ).select2({ ajax: { url: "{{route('organization-search')}}", type: "get", dataType: 'json', delay: 250, data: function (params) { return { search: params.term // search term }; }, processResults: function (data) { return { results: data }; }, templateResult: formatData, templateSelection: formatData, cache: true } });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!