title: $getJSON and for loop issue
body: <p>This is to populate a table with the amount of results that are returned from the MediaWiki API query <code>/api.php?action=query&amp;list=querypage&amp;qppage=BrokenRedirects</code>. The number of results is then added to the id, for example:</p>
  
  <pre><code>// BrokenRedirects
  $.getJSON('/api.php?action=query&amp;list=querypage&amp;qppage=BrokenRedirects&amp;format=json', function (data) {
      $('#BrokenRedirects').text(data.query.querypage.results.length);
  });
  </code></pre>
  
  <p>But as it's being repeated another 7 times I made the arguments for qppage into an array and used a for loop to shorten overall code.</p>
  
  <pre><code>var array = ['BrokenRedirects',
               'DoubleRedirects',
               'Unusedcategories',
               'Unusedimages',
               'Wantedcategories',
               'Wantedfiles',
               'Wantedpages',
               'Wantedtemplates'];
  
  for (var i = 0; i &lt; array.length; i++) {
      $.getJSON('/api.php?action=query&amp;list=querypage&amp;qppage=' + array[i] + '&amp;format=json', function (data) {
          $('#' + array[i]).text(data.query.querypage.results.length);
      });
  }
  </code></pre>
  
  <p>The first, unlooped, version works. But when I added a loop it didn't. The <code>$getJSON</code> part executes, but it then fails to add the resultant data to the id. I ran it through JSLint which apart from complaining about functions in a loop and declaring <code>var i</code> with <code>var array</code> returned little help. I'm relatively inexperienced with javascript so thought perhaps a variable can't be used twice within a loop? Other than that, maybe something to do with using an id within a loop?</p>