0
index1.htmljQuery를 자동 완성 (간단한 응용 프로그램)
<html>
<head>
<link type="text/css" rel="stylesheet" media="all" href="jquery-ui-1.8.21.custom.css"/>
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>
<script type="text/javascript" src="presidents.js"></script>
<script type="text/javascript">
$(function() {
$("#presidentsServerInput").autocomplete({
source: 'getname1.php',
minLength: 2
})
});
</script>
</head>
<body>
<label for="presidentsServerInput">Select President (server-side): </label>
<input id="presidentsServerInput"/>
</body>
</html>
getname1.php
<?php
$searchTerm = $_GET['term'];
$results=array();
$conn = oci_connect("xxxxx", "yyyyy", "zzzzzzz");
$query = "SELECT first_name FROM employees where first_name like '" . $searchTerm . "%'";
$stid = oci_parse($conn, $query);
$r = oci_execute($stid);
echo oci_num_rows ($stid);
while ($row = oci_fetch_object($stid)) {
array_push($results,$row->FIRST_NAME);
}
echo json_encode($results);
?>
내가 제대로 배열을 인쇄하고하지만 난 아니에요 FirePHP에서 볼 수
내 텍스트 상자에 제안을 받고.
누군가 내가 실수로 어디에서 이야기 할 수 있습니까?
모든 자바 스크립트 오류가 jQuery를 http://jqueryui.com/demos/autocomplete/#remote-jsonp의 예에서 완벽한 자동 jQuery를 UI에 대한 열기를 선택하고 가까운 방법으로 봐? PHP 페이지에 올바르게 액세스하고 있습니까? – Blazemonger
자바 스크립트 오류가 표시되지 않습니다. fireBug에서 다음 "NetworkError : 404 Not Found - http : //localhost/app/images/ui-bg_highlight-soft_100_eeeeee_1x100.png"를 참조하고 PHP에서 쿼리를 인쇄했습니다. SELECT first_name where first_name where 'St %' 그리고 결과 배열 [ "Steven", "Steven", "Stephen"] – Manish
이미 본 적이 있지만 jQuery UI에 [예]가 있는지 확실하지 않은 경우 (http://jqueryui.com/demos/autocomplete/#remote) 근원과. – sachleen