我正在使用jquery autocomplete.i獲取數據庫的搜索結果。 基本上,當我開始在搜索框中輸入時,我收到了一些建議。我給出了使用<a href="results.html>
結果的鏈接。但是當我點擊這些建議,我沒有去results.html
Jquery自動完成結果鏈接無法在點擊上工作
我需要重定向到results.html頁onclick上的一些建議我該怎麼做?
代碼:Jquery的
$().ready(function() {
$("#search").autocomplete("php/getvalues.php", {
width: 383,
matchContains: true,
//mustMatch: false,
//minChars: 0,
//multiple: true,
//highlight: true,
//multipleSeparator: ",",
selectFirst: false
});
});
getvalue.php
<?php
require_once "config.php";
$q = strtolower($_GET["q"]);
if (!$q) return;
$sql = "select file_name,img_url,captions from completer";
$rsd = mysql_query($sql);
while($rs = mysql_fetch_array($rsd)) {
$fname = $rs['file_name'];
$iurl = $rs ['img_url'];
$caption = $rs ['captions'];
echo '<a href="results.html" class="searchres" style="color:#696969;text-decoration:none;"><img src='.$iurl.' class="icons" /><div class="results" style="color:#696969;text-decoration:none;">'."$fname".'</div><span style="color:#696969;text-decoration:none;" class="author">'.$caption.'</span></a>'."\n";
}
?>
HTML:
<form method="post" name="myform" class="ourform">
<input type="search" id="search" name="search" placeholder="Type or speak here to search">
<input type="image" alt="submit" src="images/search.jpg" class="submit"/>
</form>
考慮發佈代碼在你的答案中,當鏈接失效時,沒有人會明白我們在說什麼。 –