title: Passing index to jQuery
body: <p>I'm trying to update a set of elements in my doc using jQuery.</p>
  
  <p>I can't pass the <code>i</code> index to the <code>$.post</code> callback function.</p>
  
  <p>here is the code</p>
  
  <pre><code>function updateValues(){
    val=document.getElementsByName('valueAN');
  
    for ( i=0; i &lt; val.length; i++ ){
      $.post('',{func:'updateAN',index:i},
        (function(data,status){
          val[i].value = data;
        })(i));
     }
  }
  </code></pre>