title: how to pass/access custom data to ajax success handler
body: <pre><code> for(var i =0; i &lt; featuredItems.length; i++) {
      var item = featuredItems.eq(i).text().trim();
      alert(item); // alerts correctly
      $.ajax({
        url : "/documents/ajax/" + item,
        dataType : "text",
        success : function(data) {
          /*
            alerts the value set in the last iteration of for loop.
            I want the same value as value of item in the ajax request URL
          */
          alert (item);     
        },
      });
    }
  </code></pre>
  
  <p>How can I access value of var item appropriately in success handler?</p>
  
  <p>Code above alerts the value set in the <strong>last iteration of for loop</strong></p>