0
オートコンプリート入力を開発したいと思います。JQueryのRoR用オートコンプリート2.3.9
私はこのための私のコントローラのアクションがあります。私の見解では
def self.get_airports(code)
#SOAP Action
begin response = @@client_airports_codes.request :tem, 'airports' do
soap.body =
{
"tem:prefixText" => code,
"tem:count" => @@airport_response_count
}
end
rescue Savon::SOAP::Fault => fault
puts fault.to_s
end
#preparing response
json = ""
response.to_hash[:airports_response][:airports_result][:string].each{
|key| json = json + key.to_s + ","
}
return json
end
:
def autocomplete_airports
render :json => WebService.get_airports(params[:airports_input])
end
get_airportsは、カンマで区切られたエントリを(、)を返し
<form id="airport_form" class="center" action="">
<label for="airports_input">Airport/City</label>
<br />
<input type="text" name="airports_input" id="airports_input" />
</form>
そして、私のJavaScript :
$('#airports_input').autocomplete('/WebServices/autocomplete_airports');
しかし、動作しません。
どうすればよいですか?
ありがとうございました!
'get_airports'メソッドコードを投稿できますか? – Brian
確かに... get_airportsコードの私の編集を見てください。 – content01