How to pass Post_ID variable from theme’s Single.php to custom Plugin using AJAX

I may be missing something in your code; but:

  1. you need to “move” the content of your test div to a JS variable that can then be used in your Ajax (or use the div value directly in your $.post.

    e.g. var postID = $('#test').val();

  2. then use it to pass the needed info to your server

    $.post( checkbox.ajaxurl, {
       action : 'submit_checkboxes',
       nonce : checkbox.nonce,
       thispost : postID,
       post : $(this).serialize()
      },
      function(response) {whatever... }
    );
    
  3. in your PHP use say intval($_POST['thispost']) to obtain the post id and use accordingly.

Note: not tested & I tend to use jQuery.ajax with a data string of values instead of jQuery.post