Use wp_send_json() WordPress function for AJAX

The header(), json_encode(), and die(), functions are all executed with
a better logical routine that should provide consistent results.