jQueryの検索例により、サードパーティのPHPスクリプトからのオートコンプリートの文字列をつかむ:のjQuery + PHP:
<script>
$(function() {
var availableTags = [
"ActionScript",
"AppleScript",
"Asp",
"BASIC",
"C",
"C++",
"Clojure",
"COBOL",
"ColdFusion",
"Erlang",
"Fortran",
"Groovy",
"Haskell",
"Java",
"JavaScript",
"Lisp",
"Perl",
"PHP",
"Python",
"Ruby",
"Scala",
"Scheme"
];
$("#tags").autocomplete({
source: availableTags
});
});
</script>
<div class="demo">
<div class="ui-widget">
<label for="tags">Tags: </label>
<input id="tags" />
</div>
</div>
<!-- End demo -->
<div class="demo-description">
<p>The Autocomplete widgets provides suggestions while you type into the field. Here the suggestions are tags for programming languages, give "ja" (for Java or JavaScript) a try.</p>
<p>The datasource is a simple JavaScript array, provided to the widget using the source- option.</p>
</div>
<!-- End demo-description -->
私はおそらく何かを必要とする以外、すべてそこオートコンプリートのコンテンツを持つ変数は、基本的だし、それは素晴らしいことだと少し複雑です。 var/xml/sqlからリストを提供する代わりに、サードパーティのPHPスクリプトによって発行されたエコーを取得する必要があります。
PHPスクリプトは、クエリに応じて適切な情報をエコーアウトします。すなわち、ユーザがcustomsearch.phpを探すか?q =レモン「パイナップル」をエコーする。
誰かが私を助けることができますか?
マニュアルを読んでください。http://docs.jquery.com/UI/Autocomplete – goat