Welcome Guest, Not a member yet? Register   Sign In
can't get autocomplete value
#1

[eluser]titolancreo[/eluser]
Hi!

I want to have an autocomplete input and I choose jquery.

I have two problems:
1. On my controller, i try to get term value but I always get 0.
2. If I recieve elements, I can`t see anything, but If I click, it works.

I have not CSRF

This is my javascript
Code:
[removed]
        $(document).ready(function()
        {

          $( "#autocomplete" ).autocomplete({
            source: function( request, response ) {
              $.ajax({
                url: "autocomplete/buscar",
                data: { term: $("#autocomplete").val()},
                dataType: "json",
                success: function( data )
                {
                   response(data)
                }
              });
            },
            minLength: 2,
            select: function( event, ui ) {
              alert( ui.item ?
                "Selected: " + ui.item.nombre :
                "Nothing selected, input was " + this.value);
            }
          });
        });
  [removed]

This is my controller. if I'm debbuging, I can see that "$term " is boolean and 0, and I need the text writen by the user.
Code:
if($this->session->userdata('logged_in'))
        {
            $term = $this->input->post('term');
            //if($buscar)
            //{
                $list=$this->DaoAutocomplete->autocompleteUsers($term );
                $i=0;
                foreach($list as $row)
                {
                    $data[]= $row; //each row has id and name
                }
                echo json_encode($data);
            //}
        }


So, how can I have in $term the string? How can I see all names in autocomplete (See photo)

Thanks!!!


Messages In This Thread
can't get autocomplete value - by El Forum - 03-30-2013, 01:19 PM
can't get autocomplete value - by El Forum - 03-31-2013, 01:49 AM
can't get autocomplete value - by El Forum - 03-31-2013, 02:10 AM
can't get autocomplete value - by El Forum - 03-31-2013, 04:32 AM
can't get autocomplete value - by El Forum - 03-31-2013, 05:58 AM
can't get autocomplete value - by El Forum - 03-31-2013, 06:10 AM
can't get autocomplete value - by El Forum - 04-03-2013, 03:35 AM
can't get autocomplete value - by El Forum - 04-03-2013, 04:55 AM
can't get autocomplete value - by El Forum - 04-03-2013, 11:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB