2011-08-26 68 views
1

。在一個即時通訊使用的笨和Ajax的自動完成的jQuery爲什麼Ajax自動完成的jQuery不工作?

在我的jQuery

我定義我的自動完成這樣的

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

.city是我輸入字段的類名

我的行動city_autocomplete是這

function city_autocomplete(){ 

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

我在這裏有硬結束值

我json_encoded陣列是這樣的

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

當我進入城市輸入框中輸入一個字母,我可以看到上面的響應JSON數組,但問題是沒有suggesion vlues顯示。當我檢查

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

沒有選擇

這究竟是爲什麼,我已經完全同樣的方式這樣做之前,它的工作完美,爲什麼不suggessons顯示。請幫我............... :(

UPDATE

這是我使用

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

回答

0

圖書館我想你不」噸允許在CI 的config.php的查詢參數允許查詢參數

$config['enable_query_strings'] = TRUE; 

OR用戶AJAX post方法

或替換jquery.autocomplete.js線

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

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