I get from server into client side only pure number IDs, how to add dynamically it to html hidden field so that looks like array or JSON format (I mean: ["32","33","34"]), so that in next step I can receive on serwer and parse? Hidden field contains on start only blank brackets [].
My current code override hidden field from [] to e.g. "32":
$("#myHiddenField").val(JSON.stringify(data.result[0].newid));
You can use $.parseJSON() to deserialize the array from the hidden input value, push() the new item, then serialize the array again:
However, it might be more efficient to keep track of the array as items are added, and only serialize it when the form is submitted (in a submit event handler, for instance).