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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:30:40+00:00 2026-06-04T16:30:40+00:00

After a few hours of deciphering tutorials, I finally got codeigniter and jquery autocomplete

  • 0

After a few hours of deciphering tutorials, I finally got codeigniter and jquery autocomplete to work with each other…kind of.

Firebug is displaying the correct search terms back in JSON format, but the drop down box is not displaying any text. If there are 2 results, it displays 2 empty rows.

you can see it ‘not working’ here: http://rickymason.net/blurb/main/home

JS:

$(document).ready(function() {
    $(function(){
        $( "#filter" ).autocomplete({
            source: function(request, response) {
                $.ajax({
                url: "http://rickymason.net/blurb/main/search/",
                data: { term: $("#filter").val()},
                dataType: "json",
                type: "POST",
                success: function(data){
                    response(data);
                }
            });
        },
        minLength: 2
        });
    });
});

Controller:

    public function search()
    {
        $term = $this->input->post('term', TRUE);
        $this->thread_model->autocomplete($term);
    }

Model:

    public function autocomplete($term)
    {
        $query = $this->db->query("SELECT tag
            FROM filter_thread ft
            INNER JOIN filter f
            ON ft.filter_id = f.filter_id
            WHERE f.tag LIKE '%".$term."%'
            GROUP BY tag");
        echo json_encode($query->result_array());
    }

Hopefully its an easy fix!

Thanks

  • 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-04T16:30:42+00:00Added an answer on June 4, 2026 at 4:30 pm

    Changing your code to something like this would work(I have tested in your site)

    $( "#filter" ).autocomplete({
            source: function(request, response) {
                $.ajax({
                url: "http://rickymason.net/blurb/main/search/",
                data: { term: $("#filter").val()},
                dataType: "json",
                type: "POST",
                success: function(data){
                   var resp = $.map(data,function(obj){
                        return obj.tag;
                   }); 
    
                   response(resp);
                }
            });
        },
        minLength: 2
    });
    

    Copy and paste the above code block in your firebug console and then try the autocomplete. It will work. I tried in your site and it worked.

    Secondly you dont need both $(document).ready(function() { and $(function(){ at the same time as they accomplish the same thing.

    Check this section of jQuery UI autocomplete

    Expected data format

    The data from local data, a url or a callback can come in two variants:

    An Array of Strings:

    [ “Choice1”, “Choice2” ]

    An Array of Objects with

    label and value properties: [ { label: “Choice1”, value: “value1” },

    … ]

    Reference: $.map

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

Sidebar

Related Questions

i'm developing a theme for wordpress in webmatrix... After few hours of normal work,
After a few hours of trying to work this out I am stumped. I
So after a few hours, I discovered the cause of a bug in my
Log4J is failing for us generally after a few hours of use in our
Alright, so after a few hours of me playing around to no avail, I
After debugging for a few hours, the algorithm seems to be working. Right now
Update: After playing around with this for a few hours, went with a multi-query
So after a few hours of workaround the limitation of Reflection being currently disabled
I have a strange problem with Eclipse (Helios). After a few hours of working
I am new to WPF and XAML, but after a few hours of googling

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.