I want to make autocomplete on my form with jQuery. The source taken from json data from php, but i don't use database.
Here is my code :
facebookfriends.php
<?php
include('facebookdata.php');
$user_friend = $user_friends['data'];
$json_friends = json_encode($user_friend);
echo $json_friends;
?>
Script
$(function() {
$( "#search" ).autocomplete(
{
source:'facebookfriends.php',
});
});
JSON DATA
[{"name":"Indiarto Priadi","id":"502163984"},
{"name":"Agustin Kertawijaya","id":"511990261"},
{"name":"Jecklyne Christin L","id":"528197912"},
{"name":"Jazi Eko Istiyanto","id":"531149275"},
{"name":"Esritha Situmorang","id":"535864892"},
{"name":"Christy Margaretha Siregar","id":"543468540"},
{"name":"Daniel Oscar Baskoro","id":"549332828"},
........]
I just want to display the name in autocomplete to ensure that the autocomplete works well. But it doesn't. Please help. Thank you!
labeland/orvalue- api.jqueryui.com/autocomplete/#option-source. Can you updatefacebookdata.phpto add alabelkey, which could just be a copy of yournamevalue.