jquery .each() within a json array

jquery .each() within a json array



From the server side, PHP sends such a json object:

  1. {"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

  1. $('#photosTab').html(function(){
  2.     $.each(json.photoFiles, function(i,item){
  3.     return '<img src="'+json.photoFiles[i]+'"><br>';
  4.     })
  5. });

Any idea on how can i produce such a code ?