I may be missing something in your code; but:
-
you need to “move” the content of your
testdiv 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
Related Posts:
- How to make comments work for a post loaded per Ajax?
- Ajax Load More Posts in Category Page
- How to load paginated post pages via ajax
- Getting the post_id in wp_ajax function
- Can I load posts via Ajax?
- Load posts dynamically
- How to load post content on index page using ajax when post title in sidebar is clicked
- How to use oEmbeds on Post Content during AJAX requests
- Show Custom Taxonomy Categories, Listing of Posts, and Single Post via AJAX
- This AJAX Code Doesn’t Work – Looking for elegant solution
- Cannot access current post’s ID in custom plugin
- Load post content into div with ajax
- POST from jQuery to PHP
- “Uncaught SyntaxError: Unexpected token
- WordPress theme ajax have_posts()
- The correct way to call posts with ajax
- How do I use Ajax to show the new posts realtime, on the frontpage
- how load content as pop-up using ajax
- Load content in a div with ajax
- How to create a load more post entries like Twitter?
- AJAX filter posts by year
- slideshow is not showing in a post call with ajax
- how to set beforsend option in wordpress ajax methods
- Filter Custom Post Type by Category with Ajax
- Ajax posts filter by date, comments, top views, top likes
- Add ajax load more function using WP API
- JSON – Permission Error?
- Ajax load more button in Recent posts widget
- Ajax Dynamic Archives not showing correct results
- WP_Query with ajax handler returns the same posts
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- Ajax post filters not working
- Loading post with Ajax
- Genesis + Ajax + Jquery | Failling to call action
- Random ajax load only works with posts_per_page set to -1
- Send post id through ajax and get the post content back
- Using ajax on editing a category edit page?
- Dynamic dependent Dropdown lists for categories, sub-categories and posts
- Auto-realod with new posts // Ajax call
- Dynamically switch template on click
- Lock post editing to one user at a time – wp_check_post_lock
- wp_query with ajax
- Call current post URL in ajax
- After ajax image is outside the “ tag
- Retrieve post in AJAX Callback
- Using AJAX and PHP to load next post object
- Automate post update for all posts?
- How to make ajax load posts from the current category?
- Using AJAX to filter posts without refreshing page
- Passing values via an Ajax querystring
- Unable to delete attached file from folder programmatically
- Javascript – How do I get specific post fields?
- How to create custom search form function including post “tags”
- how to filter posts by category without page load (ajax) in wordpress?
- Ajax: load content from post I clicked
- WP Ajax returning 0, can’t find action
- call to jquery ajax failing with 500 error when passing extra data field
- Many buttons not functioning in WordPress dashboard (as admin)
- Post data across WordPress sites
- Ajax post doesnt call succes after got the response
- AJAX load more posts not using correct category and repeating the same few posts
- Order result from ajax
- Ajaxify Post Sort
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- Dynamically load posts based on category
- WP_Query extended with AJAX
- Ajax the create and edit post form into lightbox and get results
- Ajax – Post Categories and Load More
- WP Load post with ajax and apply isotope
- How to get posts from network blog
- Get post id on click of thumbnail
- Adding a time stamp on post view
- Ajax calls in wordpress
- How to make ‘show_option_all’, that comes from wp_list_categoreis, to work with get_categories or with get_terms?
- WordPress Ajax load doesn’t work
- Code understanding
- /wp-admin/admin-ajax.php Error 500 while using divi premade layout in existing pages
- Random sort within an already sorted query
- How to validate XML-RPC post creation and cancel when needed?
- rewind_posts() – what actually the use of it, and where using is required or preferred?
- Custom Field in Featured image for A particular post
- Custom permalink structure only for default posts
- List latest posts in WP-Admin
- WordPress Number of Posts Not Changing With posts_per_page
- Problem ordering posts with numbers for titles numerically E.g. 1, 10, 100
- set role specific screen options in post summary page
- How to get a nofication when post submitted
- Post preview and oembed provider issue using polylang plugin with subdomains
- Any idea why wp_insert_post is succeeding but not returning?
- How would I get 1 latest post from a query for 5 posts?
- How can I link a CSS file only on single posts?
- add_action not using ‘delete_post’ action with wp_delete_post
- Getting post id from wp_insert_post_data function?
- Exclude posts from featuring
- Lazy Load using WP_Query pagination
- Is there any way to allow users to access content before it’s published?
- Removing rel=”nofollow” from links posted in Post Content
- Delete post by giving its link
- How to make classes for posts?
- How could I change my Permalink from blog to custom structure? [closed]