Reputation: 2462
Currently I am using plugin called jQuery TagHandler. How can I link with database to listout data. I have listed code samples below. Below code are not working. Please correct me.
js
$("#array_tag_handler").tagHandler({
getData: { id: '1', type: 'user' },
getURL: '/tag/interest',
updateData: { id: 'user234', type: 'user' },
updateURL: '/ajaxtest/update',
autocomplete: true,
autoUpdate: true
});
PHP
$select_pos = "SELECT title FROM homegrid";
$select_exec = mysql_query($select_pos);
$return_data = array();
while($dataFromDB = mysql_fetch_assoc($select_exec)) {
$return_data[]= array(
"title" => $dataFromDB['title'],
);
}
header('Content-Type: application/json');
echo json_encode($return_data);
Upvotes: 3
Views: 325
Reputation: 2462
I have removed keys from my response {"availableTags":[{"title":"Music"},{"title":"Reading"}]}
Now the response look likes {"availableTags":["Music","Reading"],"assignedTags":["Music","Reading"]}
Upvotes: 1