I have this json
var jsonobj = {'fieldname1':'test1','fieldname2':'test2'};
and I want to make the same process in Javascript or jQuery for say both jsonobj element...
I have tried
var obj = JSON.parse(jsonobj);
var fieldList = ['fieldname1','fieldname2'];
$.each( fieldList , function( i, field ) {
alert(obj.field);
});
waiting for an answer like alert('test1') then alert('test2') but not working... any idea if this is possible in a way or in another? I have also tried with obj.{field}, obj.[field] but no way, doesn't work! ^^'
Thanks much for your help!