title: jquery jcarousel initcallback pass arguments with new value
body: <p>I am trying to load new items in jcarousel on AJAX request. I have a list of different music tracks and on the click event I pass the id of the track.</p>
  
  <pre><code>&lt;ul id="itemTrack"&gt; // Track items
   &lt;li&gt;&lt;a href="#" id="p1"&gt;Track 1&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="#" id="p2"&gt;Track 2&lt;/a&gt;&lt;/li&gt;
   &lt;li&gt;&lt;a href="#" id="p3"&gt;Track 3&lt;/a&gt;&lt;/li&gt;
  &lt;ul&gt;
  
  &lt;ul id="trackList"&gt;&lt;/ul&gt; // carousel
  
  $("#itemTrack a").bind("click", getSelectedTrack); // Click event bind on the track list
  
  var theModelCarousel = null; // global variable assigned to null
  
  function getSelectedTrack(e){
    var el = $(e.currentTarget), 
    currTrack = el.attr("id"), // Track ID
    apiurl = "ServiceLibrary/player/GetTrackList/" + currTrack;   // URL to get data
    $('#trackList').html(''); // Clear carousel list
    if (theModelCarousel != null){theModelCarousel.reset();}
    $('#trackList').jcarousel({
      vertical : true,
      scroll : 5,
      initCallback: function(carousel, state){
        if (state == 'init') {
          theModelCarousel = carousel;                
        }                 
        getListRequest(carousel, apiurl);
          }
      });
  }
  
  function getListRequest(carousel, apiurl){
          $.ajax({
          type: "GET",
          url : apiurl,
          dataType : 'jsonp',
          timeout : 8000,
          success : function(data){
              if(data){               
                 // Add/Create Items HTML
              }else{
  
              }
          },
          error : function(err){
  //          alert(err);
          }        
      });
  };
  </code></pre>
  
  <p>On the above code if I click on the list item it will send the id(p1) to the 'apiurl' and gets the data but when I click on the another list item first time it will send the same old id(p1) to the ajax call and when I click second time it will send the correct id(p2). I can understand it will happen because of initcallback but did not get any resolution to clear/reset the 'apiurl' to the new value.</p>