I get ajax response as JSON and need to fill a form with it. How to do that in jQuery or something else ? Is something better than using $(json).each() ?
$(json).each()
var json={ "id" : 12, "name": "Jack", "description": "Description" }; for(key in json) { if(json.hasOwnProperty(key)) $('input[name='+key+']').val(json[key]); }
srry i thought it was the id property that was set.
here: http://jsfiddle.net/anilkamath87/XspdN/