Is it possible to conclude the code in a loop?
<p>I have 25 elements on this page: </p>

<pre><code>&lt;div id="test1"&gt;&lt;/div&gt;
&lt;div id="test2"&gt;&lt;/div&gt;
&lt;div id="test3"&gt;&lt;/div&gt;
&lt;div id="test4"&gt;&lt;/div&gt;
&lt;div id="test5"&gt;&lt;/div&gt;
</code></pre>

<p>Also I have code for update html in divs:</p>

<pre><code>setInterval(function() {

  $.post("./main/", {
    record:1,
    opt:'get_res'
  }, function(data){
    $test1=data;
  });

}, 15000);
</code></pre>

<p>To change the html in all the blocks I need to run this code 5 times, ex:</p>

<pre><code>setInterval(function() {

  $.post("./main/", {
    record:1,
    opt:'get_res'
  }, function(data){
    $test1=data;
  });

}, 15000);

setInterval(function() {

  $.post("./main/", {
    record:2,
    opt:'get_res'
  }, function(data){
    $test2=data;
  });

}, 15000);

.....
.....

setInterval(function() {

  $.post("./main/", {
    record:3,
    opt:'get_res'
  }, function(data){
    $test3=data;
  });

}, 15000);
</code></pre>

<p>For example for 25 elements div need write this code 25 times - it will be been very big code.</p>

<p>Tell me please whether implementation of the code in a loop, so as not to repeat it several times?</p>
