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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:39:06+00:00 2026-06-17T15:39:06+00:00

I am working on jquery multiple autocomplete, however, while i type something, all the

  • 0

I am working on jquery multiple autocomplete, however, while i type something, all the items are published instead of the matching ones. My Javascript is

$('.tags').bind("keydown", function(event) {
if (event.keyCode === $.ui.keyCode.TAB && $(this).data("autocomplete").menu.active) {
    event.preventDefault();
    }
}).autocomplete({
    source : function(request, response) {
        $.getJSON($.cookie('base_url') + "js/getaddressbook.php", {
            term : extractLast(request.term)
        }, response);
    },
    search : function() {
        var term = extractLast(this.value);
        if (term.length < 2) {
            return false;
        }
    },

    focus : function() {
        return false;
    },
    select : function(event, ui) {
        var terms = split(this.value);
        terms.pop();
        terms.push(ui.item.value);
        terms.push("");
        this.value = terms.join("; ");
        return false;
    }
});

The js/getaddressbook.php returns

[“gunjan.soni”,”askhr”,”saurabh.burman”,”Aditi.Nehra”,”ithelpdesk”,”shipra.kwatra”,”gagandeep.manchanda”]

Not sure where am i going wrong.

Below is the snapshot how it looks like

https://i.stack.imgur.com/SmRjX.png

Please help!

My JS controller has the function

Public function getaddressbook() {
        $this -> load -> model('common_model');
        $data = $this -> common_model -> addressbook();
        echo json_encode($data);
    }

And the common_model has the function

Public function addressbook()
    {
        $this -> db -> select('emailid');
        $this -> db ->where('emailid <>','');
        $result = $this -> db -> get('addressbook');
        if ($result -> num_rows() > 0)
        {
            foreach ($result->result() as $row)
            {
                $data[] = $row -> emailid;
            }
            return ($data);
        }
        else
        {
            return FALSE;
        }
    }
  • 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-17T15:39:07+00:00Added an answer on June 17, 2026 at 3:39 pm

    You are not passing the term anywhere in your controller.

    And of course using that term to query your database for example:

    $this->db->like('column_name', $term);  
    

    For your code, it could be:

    Public function getaddressbook() {
            $this -> load -> model('common_model');
            $term = $this->input->get('term');
            $data = $this->common_model->addressbook($term);
            echo json_encode($data);
        }
    
    Public function addressbook($term)
        {
            $this -> db -> select('emailid');
            $this -> db ->where('emailid <>','');
            $this->db->like('column_name', $term);
            $result = $this -> db -> get('addressbook');
            if ($result -> num_rows() > 0)
            {
                foreach ($result->result() as $row)
                {
                    $data[] = $row -> emailid;
                }
                return ($data);
            }
            else
            {
                return FALSE;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi all i am working on jquery i need to avoid adding multiple images
I'm working with Jquery in Drupal. I have sets of four blocks that all
Often, when working with jQuery, the need arises to include multiple plugins. This can
Uploadify is a jQuery/Flash plugin for uploading multiple files. It's working great, except I
I am working on jquery ui dialog box to display multiple images. Here is
I've managed to get multiple filters working using the jQuery Masonry plugin, the only
I installed the JQuery token-input plugin. https://github.com/loopj/jquery-tokeninput Autocomplete is working, but I have a
I'm implementing multiple autocomplete using jQuery UI. Also I'm using webservice to pass values.
I have the jQuery UI Autocomplete setup to my liking and working perfectly, but
We are working on a page with multiple tabs which has all static information

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.