I guess you have
add_shortcode
somewhere? The problem is likely that your AJAX request is a completely different request from the request to the post/page where your shortcode got interpreted in the content, so what you've evaluated in the shortcode hasn't happened in the AJAX request.