Get rid of the ID attributes, add a common class array, and give them all a name of array[].
Then use this in your jQuery;
$('input.array').click(function() {
var id = $(this).val();
$.ajax({
here goes type, url, data and else
});
})