index.php
<html>
<head>
<title>ы</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery.autocomplete.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function(){
$("#search").keyup(function(){
$("#search").autocomplete("json.php", {
delay:10,
minChars:4,
maxItemsToShow:3
}
);
}); });
//?word=" + $("#search-text").val()
</script>
<form action=""><input type="search" id="search"> <input type="submit"></form>
<body>
</html>
json.php
<?php
echo json_decode($_GET['q']);
How do make this code to work? How I can use the file json?
How in php to handle the request and return the result to the autocomplete worked?
Maybe there are better solutions?
The official documentation does not contain the server-side code example!
looked response 200ok. no body. echo json_decode ($ _GET [‘q’]); error here, the question is where?
1 Answer