Just a precaution but you could include `drupal_exit();` at the end of this function since it's an ajax callback function.

https://api.drupal.org/api/drupal/includes!common.inc/function/drupal_exit/7