jquery .each() within a json array
Hi!
From the server side, PHP sends such a json object:
- {"status":1,"recId":"PL-17534","collectionDate":"08-04-2014","collectorsName":"asdf","donorsName":"","sciName":"asdf","family":"asdf","comName":"asdf","variety":"","area":"asdf","photoFiles":["1.jpg","internet.jpg"]}
So i want to change the html content of an element , by customizing the contents of json object in the photoFiles array.
I tried something like this but doesn't seem to work
- $('#photosTab').html(function(){
- $.each(json.photoFiles, function(i,item){
- return '<img src="'+json.photoFiles[i]+'"><br>';
- })
- });
Any idea on how can i produce such a code ?