title: Display data from text file with jQuery
body: <p>I need to display/append the data from a file, <em>file.txt</em>, containing 400 lines which are in the following format: </p>
  
  <pre class="lang-none prettyprint-override"><code>http://www.exemple.com/img1.jpg, title1, subtitle1, description1;
  http://www.exemple.com/img2.jpg, title2, subtitle2, description2;
  http://www.exemple.com/img3.jpg, title3, subtitle3, description3;
  http://www.exemple.com/img4.jpg, title4, subtitle4, description4;
  http://www.exemple.com/img5.jpg, title5, subtitle5, description5;
  </code></pre>
  
  <p>I know how to append 1 line into a <code>&lt;div&gt;</code>. But, here we have 4 elements on each line. I need to turn them into 4 elements that I could use to display them.</p>
  
  <p>I am using this jQuery snippet that works fine for each line with 1 element and splits at the end of the line. </p>
  
  <pre><code>$.get('file.txt', function(data) {
    //var fileDom = $(data);
  
    var lines = data.split("\n");
  
    $.each(lines, function(n, elem) {
      $('#display').append('&lt;div&gt;&lt;img src="' + elem + '"/&gt;&lt;/div&gt;');
    });
  });
  </code></pre>
  
  <p>The HTML output would be:</p>
  
  <pre><code>$('#display').append('&lt;div class="container"&gt;&lt;div class="left"&gt;&lt;img src="' + src + '"/&gt;&lt;/div&gt;&lt;div class="right"&gt;' + title + '&lt;br/&gt;' + subtitle + '&lt;br/&gt;' + description + '&lt;/div&gt;&lt;/div&gt;');
  </code></pre>
  
  <p>Thanks for insights! </p>