私は、辞書データベースのインターフェイスを作成するプロジェクトに取り組んでいます。正しい情報を引き出せるシンプルな検索バーを作成できました。その後、jQuery を使用してテキスト ボックスのオートコンプリート機能を実装することができました。現在、検索機能に問題があります。フォームを送信すると、適切なスクリプトにリダイレクトされますが、テキスト ボックスの値がスクリプトに送信されません。
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>JQuery autocomplete example with database accessing</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css">
input.submit {
width:30px;
height:30px;
cursor:pointer;
background-image:url('../search-button.jpg');
</style>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script>
$(function() {
$( "#searchbox" ).autocomplete({
source: "data.php",
minLength: 1
});
});
</script>
</head>
<body bgcolor="#E6E6FA">
<div style="background-color:#d4e7b2;text-align:left">
<form action="../test.php" method="get" style="margin-left:1cm;">
<div class="ui-widget">
<input id="searchbox"/>
<input class="submit" type="submit" value="" style="position:absolute;margin:0px 0 0 0px;"/>
</div>
</form>
<br>
</div>
</body>
</html>
オートコンプリートはうまく機能していますが、検索ボタンを押すと、ページが "/test.php?" にリダイレクトされます。GET 変数が定義されていません。
どんな助けでも大歓迎です!