can not use Closure right
<p>I wrote JS function and it must bind the buttons it generates depending on values in the array.
But it gives me the last value. I read that i had to use closure, I did, and I'm still not able to bind them right!
I'm still a beginner 
I read about closure, I got the idea but still did not know what I'm missing</p>

<pre><code>function addNewServices(newServicesArray){
    var j=0; var x;
    for (i in newServicesArray){
        var html='';

        html='&lt;div style="width: 33%; float: leftt"&gt;&lt;a href="#" data-role="button" data-icon="home" id="btn-'+newServicesArray[j].servicename+'" value="'+newServicesArray[j].servicename+'" class="ui-btn-up-c"&gt;'+newServicesArray[j].servicename+'&lt;/a&gt;&lt;/div&gt;';
        $("#main-menu").append(html);


        $('#btn-'+newServicesArray[j].servicename).bind('click', function (){bindThis(j)});
        j++;
    }

    var bindThis = function( j ) {
        return function() {
            alert(j); // gives 2 always
            alert( newServicesArray[j].servicename ); 
        };
    };
}
</code></pre>
