How to get achievements notification popup for Ajax Callbacks? I'm using the Achievements module to award the badges to users on certain actions. 

In the following example user will get badges after posting 5 and 10 comments.

function MYMODULE_comment_insert($comment) {
  $current_count = achievements_storage_get('comment-count', $comment-&gt;uid) + 1;
  achievements_storage_set('comment-count', $current_count, $comment-&gt;uid);

  foreach (array(5,10) as $count) {
    if ($current_count == $count) {
      achievements_unlocked('comment-count-' . $count, $comment-&gt;uid);
    }
  }
}


The above code is working, user is able to achieve badge after posting 5 comments but since the comment form is being submitted through AJAX, the rewarded achievements notification popup is not being shown until page refresh. 

So how can I show achievement notification popup for Ajax callbacks? Any suggestions?
Here is another try at this (various assumptions follow):  


The whole thing should run through the Wall module's code, since this is the base for any other interaction happening.  
By means of the Form API and AJAX callbacks, there is a possible entry point. This is to wrap the submit callback for the _drupal_wall_comment_post_form into another callback that will make sure the Achievements' related elements are updated.  
The steps in this process would be:


Use hook_form_alter to modify _drupal_wall_comment_post_form 
Modify _drupal_wall_comment_post_form by hijacking the ajax callback for the wall comment submissions: 
$form['drupal_wall_submit']['#ajax']['callback'] =&gt;_your_custom_wall_ajax_callback
Wrap the original callback in your ajax callback and extend it to trigger the Achievements popup functionality using the Ajax framework commands family:

function _your_custom_wall_ajax_callback($form, $form_state) {  
  $wall_wrapper = $form['drupal_wall_submit']['#ajax']['wrapper'];
  $wall_content = _drupal_wall_comment_ajax_form_post($form, $form_state);
  $commands = array();
  $commands[] = ajax_command_replace($wall_wrapper, $wall_content);

  // This is where you can write ajax commands to trigger Achievements functionality
  $commands[] = ajax_command_*();

  return array('#type' =&gt; 'ajax', '#commands' =&gt; $commands);
}




Hope this brings you a step further!