2013-07-04 1 views
0

나는 사전 데이터베이스를위한 인터페이스를 만드는 것을 포함하는 프로젝트 작업을하고 있습니다. 정확한 정보를 추출 할 수있는 간단한 검색 창을 만들 수있었습니다. 그런 다음 jQuery를 사용하여 텍스트 상자에 대한 자동 완성 기능을 구현할 수있었습니다. 이제 검색 기능에 문제가 있습니다. 양식을 제출하면 해당 스크립트로 리디렉션되지만 텍스트 상자 값은 스크립트로 전송되지 않습니다.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 변수가 없습니다.

모든 도움을 주시면 대단히 감사하겠습니다.

답변

0

searchbox 입력에 이름을 추가해야합니다.

<input name="searchbox" id="searchbox" /> 
+0

-
변화

<input id="searchbox"/> 

그것을 맞았다! 정말 고마워! – user1261711

관련 문제