jquery 토큰 입력 플러그인 http://loopj.com/jquery-tokeninput/을 사용하여 데이터베이스의 데이터를 채우려고하지만 아무것도 표시되지 않습니다. 나는 내가 어디로 잘못 가고 있는지 알고 싶다.데이터베이스에서 데이터를 채울 때 Jquery 토큰 입력이 작동하지 않습니다.
나는 어떤 대안의 접근 방식
내가 작동하지 않는 것 검색 모든 예를 수락.
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js">
</script>
<script type="text/javascript" src="src/jquery.tokeninput.js"></script>
<link rel="stylesheet" href="styles/token-input.css" type="text/css" />
<link rel="stylesheet" href="styles/token-input-facebook.css" type="text/css" />
<div>
<input type="text" id="tagcool" name="blah" />
<input type="button" value="Submit" />
<script type="text/javascript">
$(document).ready(function() {
$("#tagcool").tokenInput("phpsearch.php", {
theme: "facebook",
preventDuplicates: true,
});
});
</script>
내 인덱스 페이지 그리고 내 PHP 페이지 내 DB의
<?php
$link = mysqli_connect("localhost","root","","dbname") or die("Couldn't make connection.");
$look = $_GET['q'];
$arr = array();
$rs = mysqli_query($link,"SELECT * FROM `country` WHERE name like '%".$look."%'");
# Collect the results
while($obj = mysqli_fetch_object($rs)) {
$arr[] = $obj;
}
# JSON-encode the response
$json_response = json_encode($arr);
# Optionally: Wrap the response in a callback function for JSONP cross-domain support
if($_GET["callback"]) {
$json_response = $_GET["callback"] . "(" . $json_response . ")";
}
# Return the response
echo $json_response;
?>
예
플러그인 옵션 (답변이 아님)에서 여분의 쉼표를 먼저 제거하고 정확하게 작동하지 않는 것을 더 설명하고, 콘솔 및 기타 디버그 정보에 무엇이 있는지 설명합니다. – vinayakj
오류 또는 결과를 반환하지 않습니다. 그냥 검색을 말합니다 ... –
네트워크 탭의 기능, 아약스 상태는 무엇을 보여줍니까? jsfiddle를 만들 수 있습니까? – vinayakj