I use typeahead.js with Local data source and worked, but when i try to collect data from remote url i have no luck this is my code :
$('#keyword').typeahead({
minLength: 3,
remote: 'http://example.com/includes/search.php?g=%QUERY',
limit: 10
});
and this is my php code :
<? PHP
$qsrc = mysql_query("SELECT `state_id` AS `all_id`,`name` AS `names`, MATCH(name) AGAINST('".$_REQUEST('g')."') AS `score` FROM `_state` WHERE MATCH(name) AGAINST('".$_REQUEST('g')."' IN BOOLEAN MODE) ORDER BY `score` DESC");
$arr = array();
while ($rsrc = mysql_fetch_assoc($qsrc)) {
$arr[] = array('id' = > $rsrc['all_id'], 'name' = > $rsrc['names']);
}
echo json_encode($arr);
?>
did i miss something?