I want to store a json object into a hidden input for submit and send to server side.
<input type='hidden' id='permissions' name='permissions' />
During submission :
<input type='hidden' id='permissions' value='[{"1" : "deny", "2": "deny", "5" : "allow"}]' name='permissions' />
I used bellow line but not working :
$('#permissions').val(json_object);
Use JSON.stringify like
$('#permissions').val(JSON.stringify(json_object));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With