I have the following function called twice:
function (data) {
   $.each(data.items, function(i,item) {    
                  var $items = $('<div class="col-sm-4 grid-item"><div class="thumbnail"><input type="checkbox" name="thing_'+i+'" value="valuable" id="thing_'+i+'"/><label for="thing_'+i+'"><img class="img-responsive" src="' + item.link + '"></label></div></div>');`enter code here`
It generates checkboxes and I am generating the identifier name for and id with the i, giving me:
thing_1
thing_2
thing_3
The problem is that when I run the function the second time, the i starts again, resulting in duplicated ids and name and for
 
    