I am using a hidden field and appending values with the following function.
$( "#invite_suggestion" ).autocomplete({
source: BASEURL + 'index.php/search_contacts_suggestion/',
select: function( event, ui )
{
$('#invite_id').val($('#invite_id').val()+ui.item.friend_id);
}
});
In the PHP side
$_POST['invite_id']=(isset($_POST['invite_id']))?json_encode(array($_POST['invite_id'])):json_encode(NULL);
But Actually the final output of this is string ["4565"] and what i actually need is to JSON encode of individual values in field ["45","65"]