Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7510507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:14:24+00:00 2026-05-29T23:14:24+00:00

I am trying to implement the jQuery autocomplete plugin by receiving the data through

  • 0

I am trying to implement the jQuery autocomplete plugin by receiving the data through a servlet.
The script works and it does pull the results from the servlet but I can’t get it to render properly in the drop down menu. Say I write “hel” in the search bar, the autocomplete drop down list is:

h
e
l
l
o

From what I understand, the autocomplete plugin is supposed to receive an array and I think that may be the issue.
This is my javascript code:

<script>
function getFilteredNames(request, response){

    $.ajax({
        type: "POST",
        url: "../servlet/Autocomplete", 
        data: request,
        success: function(data) {
            response(data);
        }
    });
}

$(document).ready(function(){
        $("#buscar").autocomplete({ source : getFilteredNames, minLength: 3}); 
});
</script>

And this is part of the servlet code:

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();

        try {
            String query = request.getParameter("term");
            List<Socio> rs = new ArrayList<Socio>();    
            rs = SocioDAO.getSociosByQuery(query);      

                if (rs.isEmpty()) {
                    out.println("No hay coincidencias");
                }
                else {

                    Iterator <Socio> iterator = rs.iterator();
                    while (iterator.hasNext()) {
                        String nombre = (String) iterator.next().getNombre();
                        out.println(nombre);
                    }

            }

Any suggestions would be greatly appreciated!
Thanks,
Nick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:14:27+00:00Added an answer on May 29, 2026 at 11:14 pm

    The autocomplete UI plugin accepts array,object formatted in JSON data.

    1. So u have to put datatype:json in ur $.ajax Call
    2. As u r using servlet u have to format it in json format before
      sending to client side through ajax call.

    for converting ur data to json format u can use utility call provided by http://www.json.org/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to implement the jquery autocomplete plugin. I've got it up and running,
I'm trying to implement a jQuery slider with increments. I've gone from, the actual
Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to
I am trying to implement the jQuery plugin, prettyPhoto, on my page. I used
I'm trying to implement a JQuery script to process some areas inside an image
I'm trying to use the official jQuery autocomplete plugin with an ASMX web service
I am currently trying to implement the wonderful jQuery plugin 'week calendar' ( here
I'm trying to implement the awesome Dropkick jQuery plugin , but for some reason
I am trying to implement auto complete via jquery auto complete plugin.A simple auto
I am trying to implement caching using jQuery UI autocomplete. I am using jQuery

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.