jQuery('#singleFieldTags').tagit({
//availableTags: tagvalues,
// This will make Tag-it submit a single form value, as a comma-delimited field.
singleField: true,
singleFieldNode: jQuery('#mySingleField'),
allowSpaces: true,
placeholderText: "Type your designation!",
tagSource: function( request, response ) {
//console.log("1");
jQuery.ajax({
url: "/user/edit/getdesignationlist",
data: { term:request.term },
dataType: "json",
success: function( data ) {
response( jQuery.map( data, function( item ) {
return {
//label: item.value+" ("+ item.id +")",
label: item.value,
value: item.value,
id: item.id
}
}));
}
});
},
autocomplete: {delay: 0, minLength: 1,
select: function (event, ui) {
console.log(singleFieldTags + "=" + ui.item.id);
if( jQuery('#designation').val() != '')
{
jQuery('#designation').val(jQuery('#designation').val()+ "," +ui.item.id);
}
else
{
jQuery('#designation').val(ui.item.id);
}
}
});