I try to use the JQuery Tokeninput. While I introduce on the search fields the text , it doesn't show anything. It stays on searching forever...
From the documentation I see that the format of the resunt of json_encode should looks like :
[{"id":"856","name":"House"},
{"id":"1035","name":"Desperate Housewives"},
...]
but when I access my json localhost/json.php?q=house returns datas like :
["house1","house2" ...]
so it doesn't contains the "{}" .
I'm sure that the paths to the js,and css are ok. the script is here:
<script type="text/javascript">
$(document).ready(function () {
$("#textarea").tokenInput('link/json.php');
});
</script>
The json code looks like :
$rows = array();
$q=$_GET['q'];
$query_get_element = "SELECT DISTINCT `column` FROM `table` WHERE `column` LIKE '%".$q."%'";
$query_get_element = mysql_query($query_get_element);
$row_cen = mysql_fetch_array($query_get_element);
$json=array();
while ($row2 = mysql_fetch_array($query_get_element))
array_push($json, $row2['column']);
echo json_encode($json);
While I search the console shows localhost/json.php?q=house Any advice to solve this ? Thanks in advance!
on console (google chrome I see:
GET http://localhost/json.php?q=house 404 (Not Found)