I’m using the jQuery template plugin to generate HTML from JSON data which the user than manipulates (and, potentially alters). I’m looking for a way to read this html back into JSON so I can save it back to my server. jQuery offers a $.tmplItem() method which returns the originally set data JSON but I’m wondering how I can get the values as they are in the current DOM?
I’m using the jQuery template plugin to generate HTML from JSON data which the
Share
How about this?
http://jsfiddle.net/mWuHe/14/
Pull out the HTML of your area, then convert it back to JSON:
btw I used
JSON.stringifyfor simplicty, but in a production environment you should probably use a library like jquery-json, since some old browsers that don’t support that are still skulking around.