I want to load some form elements for a custom post type’s edit screen via AJAX.
What’s the best practice to implement this?
Should I use this algorithm?
Hook an action to
admin_menu
todetect the request from AJAX client (via
x-requested-with
),clean the buffer (via
ob_clean
),output the requested element, and exit.
Request
wp-admin/post-new.php
from AJAX client