.click function

.click function

Hi, i hope somebody can help me.

I'm sending some information to a php file using jQuery.Ajax.
In the meantime i add a button to the page called delete_0 for the first element, delete_1 for the second, ....
 The php generates a unique ID and I need it back in the JS
Therefore i tried to let the php run a js function in the end:
addItemToQueue ( ID );
function addItemToQueue(ID){
jQuery("#delete_" + ID ).click(function (){
alert(ID);
});
}

The whole system works quite well for the first element; but as soon as i add a second one, it only works for the 2nd and not for the first one anymore and when i add a third one, it only works for the third but not for the first two elements.

Could you please tell me, why this happens and how i can solve the problem?

Thanks in advance