用json jquery多次自动完成

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

http://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;
        }
    }

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;
        }
    }