Hello!
I also posted this question on stack exchange, but I have not received an answer so I thought i'd post it here:
http://drupal.stackexchange.com/q/15760/4098
I want to change the delete link on comments so that the delete confirmation is returned with Ajax and then the delete confirmation is executed with Ajax.
I have fixed the form so the delete confirmation at /comment/%cid/delete so now the submit action is performed with ajax.
Here is the code I used to accomplish this:
function awesomesite_comments_form_comment_confirm_delete_alter(&$form, &$form_state, $form_id) {
// Add the Ajax Submit Function
$form['actions']['submit']['#ajax'] = array(
'callback' => 'awesomesite_comments_ajax_delete',
'progress' => false,
);
}
function awesomesite_comments_ajax_delete($form, $form_state) {
// Get rid of all of the messages that have been set
drupal_get_messages();
// Get the comment & node objects
$comment = $form_state['comment'];
// Put all of the Ajax Commands into an array
$commands = array();
// Place the comment above the form
$commands[] = ajax_command_remove('#comment-'.$comment->cid.', comment-'.$comment->cid.' + .comment');
// Return the Ajax Commands Array
return array('#type' => 'ajax', '#commands' => $commands);
}