I would handle this slightly differently. I would have each delete icon followed by a hidden input that contains the value of the item corresponding to the id of the item to be deleted. I would then use jQuery to extract the value attribute of the hidden field. This way, you won't have to do any magic string manipulation to use numeric ids.
Also, never use a get request to do a delete. All some one has to do is type a URL in the proper format, with the proper credentials to bypass any client-side processing you've added to validate your deletion. AJAX allows you to send other types of requests and you should prefer a POST or DELETE request for deletes.
echo '<img class="deleteIcon" src="images/delete.png" />';
echo '<input type="hidden" value="' + $item[id] + '" />';
$('.deleteIcon').click( function() {
var id = $(this).next('input[type=hidden]').attr('value');
$.ajax({
url: 'ajax/delete.php',
type: 'delete',
data: { id: id },
dataType: 'json', // get back status of request in JSON
success: function(data) {
if (data.status) {
// remove row, or whatever
}
else {
// handle deletion error
},
... other parameters/callbacks ...
});
});