title: jquery $.ajax function using a variable URL
body: <pre><code>var array = new Array();
  $.get('comics.txt', function(data) {
      array = data.split(",");
      for(var i = 0; i &lt; array.length; i++)
      {
          var $page = array[i];
          $.ajax({
              url: $page,
              success: function(data) {
                  alert(data);
              }
          });
      }
  });
  </code></pre>
  
  <p>comics.txt is a file which contains some urls, separated by commas.</p>
  
  <p>In the above code, the $.ajax call does not work; $page is the correct url, but it's not working in the context.  alert(data) causes a blank alert box to come up.  I need help figuring out a way to get the data from each page in the array called array.</p>
  
  <p>Thanks ahead of time.</p>