jQuery: write variable between 2 quotation mark
<p>I want to create a loop for input so that the variable img get number 1 to 5 like this: </p>

<pre><code>img1, img2 ... img5.
</code></pre>

<p>How to write <code>$i</code> after img?</p>

<pre><code>for ($i=1;$i&lt;=5;$i++) {

  function(data) { $('input[name="img1"]').val(data) });

}
</code></pre>

<p><strong>Note:</strong> img is between <strong>two</strong> quotation mark.</p>

<p>it's edite:</p>

<pre><code>user = $('input[name="name"]').val();
for (var i = 1; i &lt;= 5; i++) {
  $.post("test.php", { name: user, num: i },
  function(data) {
    $('input[name="img'+i+'"]').val(data)
  });
}
</code></pre>
