How to delete a theme using AJAX

You can do this by creating a post form with a nonce field…

$url = admin_url('admin-ajax.php');
echo '<form action="'.$url.'" method='post'>';
echo '<input type="hidden" name="action" value="delete_theme">';
wp_nonce_field('updates'); // to pass check_admin_referer
echo '<input type="hidden" name="slug" value="twentythirteen">';
echo '<input type="submit" value="Delete TwentyThirteen Theme">';
echo '</form>';

You can replace the hard-coded slug input field with a <select> one and loop through installed themes to add them as the select options if you like, but I’ve given it this way because you say you want to delete a theme.

tech