title: jQuery ajax inside a loop problem
body: <p>This js loop script always get the last value of ui_item inside a jquery ajax funciton. How can a catch the correct value of each iteration?</p>
  
  <pre><code>for (var i = 0; i &lt;= split_files_cb_value_holder.length - 1; i++){
      var split_values = split_files_cb_value_holder[i].split(':');
  
      ui_item = split_files_cb_value_holder[i];
  
      $.ajax({
          type: "POST",
          url: "ds/index.php/playlist/check_folder",
          data: "component_type="+$('#component_type').val()+"&amp;value="+split_values[1],
          success: function(msg)
          {
              console.log(ui_item); //ALWAYS GETS THE LAST VALUE
          },
          error: function()
          {
              alert("An error occured while updating. Try again in a while");
          }
      });
  
  }
  </code></pre>
  
  <p>Thanks!</p>