I have a big dictionary consisting of multiple fields.
var deal = {‘foo’:’moo’,’foo1′:’moo1′,’foo2′:’moo2′,’foo3′:’moo3′,’foo4′:’moo4′,’foo5′:’moo5′}
I want to store this as a hidden input field.
i.e.
`
<div class="deal">
<input type="hidden" value=deal />//unique for this div
</div>
<div class="deal">
<input type="hidden" value=deal />//unique for this div
</div>
<div class="deal">
<input type="hidden" value=deal />//unique for this div
</div>
Retrieving
$(".deal").on('click',function(){
var deal= $(this).find('input').val();
});
And retrieve this using jQuery. While retrieving this by jQuery I am facing issues i.e. I think the entire data is not being stored.(Half the dictionary is being truncated.)
Should I instead just query my database and get this? or is there a way to store the dictionary as the input field value ?
If the question is not clear please comment. I will make necessary additions.
Maybe you could store your data in Javascript and have reference on your HTML elements to those JS vars? Like:
And then just bind it like this: