I have followed this answer and this is the code have:
ajax receiver:
success: function(data) {
jQuery("#assigncat").val(function(i,val) {
return val + (val ? '' : ', ') + data.cat_id;
});
But I get:
230231
<input id="assigncat" value="230231">
While I should get: 230,231
<input id="assigncat" value="230,231">