I am using MVC 5 and the Select2 plugin in a Ajax form.
The object looks like this in the Chrome console: https://i.sstatic.net/bGOpg.jpg (was easier to show the object as a picture)
What I would like is to extract the ID and Text and save that to my DB. As a stringified object. Noticed it's alot of other solutions that just saves the ID/Value then do roundtrip to DB for the text. But I would like to just stringify the object and only save the id and text and then on page load serialize the object from the hidden field back to the Select2 box.
When I try to use the JSON.stringify method I get an error:
Uncaught InvalidStateError: Failed to read the 'selectionDirection' property from 'HTMLInputElement': The input element's type ('hidden') does not support selection.