>$.ajax({ > type: "POST", > url: "test.php", > data: "query:edit&id="+idval, > > dataType: "json", > success: function(data){ > $.each(data, function(index, value) { > id = '#' + index; > $(id).val(value); // does anyone know if this works?
The $.val() method only works with text fields (or more specifically, elements that have a value property.) If you want a method that will work with any field type, check out my Field plug-in: http://jquery.com/plugins/project/field It'll work with radio, checkbox and select elements--along with text elements. -Dan