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

  • Home
  • SEARCH
  • 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 4052224
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:17:36+00:00 2026-05-20T14:17:36+00:00

Hi could some one please take a look at this and let me know

  • 0

Hi could some one please take a look at this and let me know where I’m going wrong. I am trying to get jQuery UI autocomplete to work. this is my code:
This is search.php

include "db_connect.php";
$search = $_GET['term'];    
    $result = mysql_query("SELECT Title FROM `movie` WHERE `Title` LIKE '%$search%' ORDER BY Title ASC") or die('Something went wrong');
    $rows = array();
    while ($row = mysql_fetch_assoc($result)){
        $rows[] = $row;

    }
print json_encode($rows);
?>

this is my javascript inline script

<script type="text/javascript">
    $(document).ready(function()
    {
        $('#auto').autocomplete(
        {
            source: "./search.php",
            minLength: 3
        });
    });
</script>

and this is the ‘auto’ div

<div id="searchTxtFieldDiv">
<p><input type="text" id="auto" /></p>
</div>

When I look at the call using firebug I see that search.php is returning

[{"Title":"Sin City"}]

jQuery is just displaying UNDEFINED
any ideas??

  • 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-20T14:17:37+00:00Added an answer on May 20, 2026 at 2:17 pm

    Have a look at jquery ui autocomplete documentation. The JSON you are returning does not match what the autocomplete is looking for. The object you return must have properties named label or value (or both).

    You can try the following options:

    Option 1: Change returned JSON

    Change the JSON being returned to include the label/value properties such as:

    [{"label":"Sin City"}]
    

    From the examples it also seems to use the id property. I believe the above is the minimum requirement for the autocomplete to display a list of values. I think you can also return an array of strings and it will render it in exactly the same way as the above.

    [ "Sin City", "Etc" ]
        
    

    Option 2 : Change private _render function

    Change the private _renderItem function for the autocomplete to use your custom properties as shown in this autocomplete example (untested):

    $( "#project" ).autocomplete({
        source: "./search.php",
        minLength: 3    
    })
    .data( "autocomplete" )._renderItem = function( ul, item ) {
        return $( "<li></li>" )
       .data( "item.autocomplete", item )
       .append( item.Title )
       .appendTo( ul );
    };
    

    This is a bit more flexible but much uglier imho.

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

Sidebar

Related Questions

Please take a look at this piece of code. I'm allocating one byte for
Could someone please take a look at this sloppy code and explain to me
Could someone take a look at this code and find out what's wrong with
Could someone please take a look at this ? You'll see the first alert
Please see following examples first, and which one is better? Could you compare some
Would someone please take a look at the following code fragments (all from one
Hey guys, please take a look at my code and see what's wrong here.
Could some on with Firebug or other tool check out this page. Take a
Could someone please demystify interfaces for me or point me to some good examples?
Let's say I am writing an API, and one of my functions take a

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.