$post not working working in AJAX plugin with custom post type

If I understand correctly- this is an AJAX request, there is no $post var because you haven’t loaded anything from the database in this request. You have to pass both the ID you want to relate it to, and also the ID you want to relate it from, neither exist in the current request.