I am working with jQuery autocomplete plugin and this is my index:
<script>
$(document).ready(function(){
$("#tag").autocomplete({source: "./search.php?q="+ $("#tag").val()});
});
</script>
<form action="search.php" method="post" class="form-inline search">
<input type="text" id="tag" name="tag">
<input type="submit" class="btn" value="Search" />
</form>
in search.php which is in the same folder as index.php is following:
include 'config.php';
$q=$_GET['q'];
$my_data=mysql_real_escape_string($q);
$sql="SELECT * FROM tags WHERE tag LIKE '%$my_data%'";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
while($row=mysql_fetch_array($result))
{
echo $row['tag']."\n";
}
}
When I start typing, autocomplete doesn't offer me any suggestions. Also no errors in JS console. In the code is just displayed No search results..
The paths are set up correctly, the database connection as well.
Thus, where could be a problem?
Thank you