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 9076133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:02:37+00:00 2026-06-16T19:02:37+00:00

I am trying to use http://jqueryui.com/autocomplete/#multiple-remote on my site, but i can’t get it

  • 0

I am trying to use http://jqueryui.com/autocomplete/#multiple-remote on my site, but i can’t get it to give correct results.

My HTML is :

<input id="movies-text" size="50" />

My Jquery code is :

$('#movies-text').autocomplete({
    minLength:3,
    source:function(request,response){
        $.getJSON('searchmovies.jsp',{q:request.term},function(result){
            response($.map(result,function(item){
                return item.value;
            }));
        });
    }
});

And searchmovies.jsp looks like this :

<%@ page contentType="application/json" language="java" import="java.sql.*" errorPage="" %>
<%
   response.setContentType("application/json");
   response.setHeader("Content-Disposition", "inline");
%>

[
    {"value":"Pulp fiction"},
    {"value":"The hobbit"},
    {"value":"Apocalypse Now"},
    {"value":"As good as it gets"},
    {"value":"Annie hall"},
    {"value":"Butch Cassidy and the sundance kid"},
    {"value":"Terminator"}
]

It gives all the values in the dropdown no matter what i type.

  • 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-06-16T19:02:39+00:00Added an answer on June 16, 2026 at 7:02 pm

    Here for your case you have two options,

    Option1: Populating json based on request term (Best Approach)

    Your jsp response should match with the query string, here you are blindly populating all the values as response but it should be based on your request string.

    For Example,

    If your input string is “Pulp” then your jsp should return back only,

     [{"value":"Pulp fiction"}}
    

    There is nothing to complain about jQuery its working based on its nature and you need to tweak your server side json to produce the output based on your input query.

    Option2: Adding a filter to the whole populated Objects

    Consider this example test.html,

    <html>
    <head>
        <title>jQuery UI Autocomplete - Remote Data functionality with Filter</title>
        <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
        <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
        <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
        <script>
    
    function loadData(){
        var movie_elements;
        $('#movies-text').autocomplete({
            minLength:3,
            source:function(request,response){
               $.getJSON('searchmovies.jsp',{q:request.term},function(result){
                movie_elements = $.map(result,function(item){return item.value;});
                response( $.ui.autocomplete.filter(movie_elements, extractLast( request.term ) ) );
               });
            }
        });
    }
    
    function split( val ) {
                return val.split( /,\s*/ );
            }
    
    function extractLast( term ) {
                return split( term ).pop();
            }
        </script>
    </head>
    <body onload="loadData();">
    <input id="movies-text" size="50" />
    </body>
    </html>
    

    Pick the one which suits best for you.

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

Sidebar

Related Questions

I am trying to use jQuery with multiple selections from http://jqueryui.com/autocomplete/#multiple-remote The js works
I'm trying to use this example http://jqueryui.com/demos/autocomplete/#combobox . But it shows blank option by
Fairly new to jQuery, trying to use Autocomplete. Went to http://jqueryui.com/download to build my
I am trying to use datetimepicker from: http://trentrichardson.com/ functionality is working it seems, but
I'm trying to use the jquery datepicker - http://jqueryui.com/demos/datepicker/ in a custom control (.ascx).
I am trying to use jquery-ui slider ( http://jqueryui.com/demos/slider/#steps ) where the value of
I'm trying to use DatePicker from jQueryUI but get this error and didn't know
I'm trying to use the jqueryui dialog ( http://docs.jquery.com/UI/Dialog ) within my html page.
I'm using jquery autocomplete <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script> <script src='http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js'></script> Everything is working Ok., but now
So im trying to use the slider demo (http://jqueryui.com/demos/slider/#range) and i copy the code

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.