title: Looping through json object returned from jquery ajax call
body: <p>I have returned three values from an ajax call. Here is the content of the json object in my console log:</p>
  
  <pre><code>{"no":"img2","name":"mylogo.jpg","location":"u_images\/1\/"} 
  </code></pre>
  
  <p>-No is meant to refer to the thumbnail div container where i want to display a thumbnail of the image uploaded by the user</p>
  
  <p>-name is obviously the name of the file</p>
  
  <p>-location refers to the file path where the user has uploaded the file to, where i want to grab the file and display in the thumbnail.</p>
  
  <p>-1 at the end of the location is the folder which is given the id of the user.</p>
  
  <p>Here is what i've tried:</p>
  
  <pre><code>   success: function(data)
      {
  
         if (data != '') 
         { 
              //console.log(data);
  
              var data = $.parseJSON(data);
  
              $(data).each(function(num,name,loc) //this looks stupid i know,but it's just the last   //of the hundred things i've tried-i know the fault has to lie here in my loop syntax.
  
         {
              var imgsrc = loc+'name'; 
              $('#'+num+'div').html('&lt;img src="'+imgsrc+'" width="50" height="50" /&gt;');
  
         });
  
       }
   }
  </code></pre>
  
  <p>So when i submit the form, i get the returned object in my console log alright, but my other code to replace the loading gif image in the thumbnail with the image of the file just uploaded does not work, and i get no errors either.</p>
  
  <p>Any help or advice much appreciated.           </p>