title: Loop through a string with jQuery/javascript
body: <p>I am loading a simple txt file from the same server as the current web page using jQuery - this file will always include a plain number with no formatting - e.g. 123456</p>
  
  <pre><code>$(document).ready(function(){    
  
    var test;
    $.getJSON('myfile.txt', function(data) {
      test = data;
      showAlert(); // this call will display actual value
    });
  
    function showAlert() {
      alert(test);
    }
  
  });
  </code></pre>
  
  <p>At the moment, the code pulls the file in and then shows the content in an alert box but what I want to do is read through the response character by character and create an HTML string which I can then insert in to the page - each character would be converted to an image tag.  </p>
  
  <p>For example if the response was 123 I want to create a string holding the following HTML:</p>
  
  <pre><code>&lt;img src="1.png" /&gt;
  &lt;img src="2.png" /&gt;
  &lt;img src="3.png" /&gt;
  </code></pre>
  
  <p>And then I will insert that string into a div on my page.</p>
  
  <p>Can anybody suggest how to go about looping through the response to create the img tags?</p>
  
  <p>Thanks</p>