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