How to format and add new numbers dynamically to hidden field?

Posted by Bartek on Stack Overflow See other posts from Stack Overflow or by Bartek
Published on 2012-09-23T09:35:09Z Indexed on 2012/09/23 9:37 UTC
Read the original article Hit count: 271

Filed under:
|

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));

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery