js onclick working strange : <p>I have the next code </p>

<pre><code>$.ajax({
                url: '/data',
                type: "POST",
                data: JSON.stringify(formData),
                contentType: "application/json",
                dataType: "json",
                success: function(response){
                    for (var i=0; i&lt;response.length; i++) {

                        var htmlEdit = "creating button here";
                        var btnEdit = jQuery(htmlEdit);
                        btnEdit.appendTo(divCollapse);
                        btnEdit.click(function() {
                            editBooking(btnEdit);
                        });
                    }
               }
});


function editBooking(btn) {
    btn.button('loading');
}
</code></pre>

<p>So I have rows with identical items. Buttons are shown as expected. Click to any button invokes loading state for the <strong>last</strong> button. What I'm doing wrong? Thank you.</p>
