I may be missing something in your code; but:
-
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();
-
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... } );
-
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