开发者

why Ajax AutoComplete for jQuery not working?

hi a im using codeigniter and Ajax AutoComplete for jQuery

in my jquery i define my auto complete like this

    a = $('.city').autocomplete({
        serviceUrl: "<? echo $this->config->item('base_url'); ?>home/auth/city_autocomplete",
    });

.city is the class name of my input field

my action city_autocomplete is this

    function city_autocomplete(){

        $array = array('query'=>'Li','suggestions' => array('Liberia','Libyan Arab Jamahiriya','Liechtenstein','Lithuania'));                       
        echo  json_encode($array) ;
    }

i h开发者_运维百科ave hard corded values here

my json_encoded array is this

{"query":"Li","suggestions":["Liberia","Libyan Arab Jamahiriya","Liechtenstein","Lithuania"]}

when i enter a letter in city input box , i can see the above response json array , but the problem is no suggesion vlues is displayed . when i check

<div id="AutocompleteContainter_c6592" style="position: absolute; z-index: 9999; top: 590.85px; left: 533.383px;">

there is no options

why is this happening , i have done this before exactly the same way and it worked perfectly , why the suggessons not showing . please help me ............... :(

UPDATE

this is the library i am using

http://www.devbridge.com/projects/autocomplete/jquery/


I think you don't allow query parameters in config.php of CI allow the query parameters

$config['enable_query_strings'] = TRUE;

OR user ajax post method

or replace the line in jquery.autocomplete.js

$.get(this.serviceUrl, me.options.params, function(txt) { me.processResponse(txt); }, 'text');

to

$.post(this.serviceUrl, me.options.params, function(txt) { me.processResponse(txt); }, 'text');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜