I think you should be able to do this:
HTML:
<a class="view_post_details" href="#" post_id="<?php the_ID(); ?>">View Post Details</a>
JS:
$(".view_post_detals").click(function () {
var id_post = $(this).attr('post_id');
$.ajax({
type: 'POST',
url: '<?php echo admin_url('admin-ajax.php'); ?>',
data: {
'post_id': id_post,
'action': 'f711_get_post_content' //this is the name of the AJAX method called in WordPress
}, success: function (result) {
alert(result);
},
error: function () {
alert("error");
}
});
});
Related Posts:
- Storing posts from query and accessing later via AJAX call
- JS innerhtml changing style when using AJAX
- Dynamic Custom Fields
- Passing total post count to javascript
- get total post in category via ajx
- Default post showing more than intended
- Load more post with AJAX
- Post current post type to my Ajax
- Ajax load more post button not showing
- How to enqueue scripts on custom post add/edit pages?
- AJAX search on post pages by custom post type
- Development of a WordPress Search Plugin – Best Practices
- Updating custom post meta with ajax
- Favouriting a Custom Post Type
- WordPress post sorting with AJAX
- Filtering custom posts with Ajax
- Prevent reload confirmation after AJAX save
- is_singular() not working if called via callback function of admin-ajax.php
- How to filter post data with AJAX on page?
- Debug whats going on inside a function called from AJAX
- Is there an easy way to AJAX-ify saving of post?
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- Full-Ajax Theme: parseJSON error while building a JSON object from a WordPress custom template
- Calculate Repeater Meta Box Input Field Values and Display Total
- How to localize value of posts
- How to create a repeatable / reusable divs in the metabox?
- Custom Scripts per page or Custom Post Type
- How do you use JavaScript to detect the homepage
- wp is not defined error using wp.media to create a custom image uploader
- How to use wp_mail in CPT page
- WordPress Rest API only returns content when posttype has editor capability
- Filter custom post type archive page with custom taxonomies (categories) with AJAX
- Ajax form filter post by custom fields [closed]
- How to load custom post archives sub-pages with ajax?
- Display custom post data in sidebar w/ dropdown
- Open div inside a custom post-type with Fancybox
- Very simple wordpress block to display posts from an api call
- Getting the URL of the parent page
- How to get the parent of a non-hierarchical custom post type being edited in Gutenberg
- Ajax Check Post Status
- Received nothing after executing AJAX post function
- Filtering WP_Query Dynamically on the Front-End
- Why get_posts() not returning only selected category posts from Custom Post Type?
- Push metadata in array
- Loading custom content type from ajax results?
- How to add a custom-post-type post within another custom-post-type post edit screen using AJAX?
- AJAX load more for different custom post type loops
- Ajax Custom Post Filter is not filtering
- Save the post parent in a custom post type in Gutenberg
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Plugin – Combine Meta Box Input Fields into single saveble record
- Side effects of Script and Iframe in post
- Custom post type – use ajax to display sub pages
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Load Custom_post_type categories post with ajax
- Load Next Posts With AJAX not working with custom post type
- Multiple Frontend Filters Using Advanced Custom Fields
- Pagination with custom query, custom search form, single and pages, ajax and no plugins
- Retrieve custom post types by custom taxonomies with WP_Query
- $post not working working in AJAX plugin with custom post type
- Extracting Address from Custom Post via Javascript for Google Maps API
- Load Next WordPress Posts With AJAX?
- Custom post type’s extra fields – how to handle?
- Combine multiple getEntityRecords calls
- Custom Post Type Slick Slider “$ is not a function”
- Using wp_localize_script to get data from cpt and pass it to maplace-js locations
- Getting 400 Bad Request on AJAX Call
- admin-ajax.php GET custom-post titles
- Post will not load via ajax
- Select2 AJAX and WP Query Returns ALL and does not filter
- ajax response not recieving
- Get data from PHP to JavaScript to set position of each post on front page
- Getting a GET error in console – 404 not found for wp-json
- WordPress notification if new post published
- filter by custom taxonomy using ajax
- Why is wp api returning old acf values?
- passing values from functions.php to template
- How do I update_post_meta() or add_post_meta() with an AJAX call
- Multiple wp_editor instances in custom post type using Ajax
- Loading multiple post content in FancyBox
- Change Post Meta via AJAX from the posts list table
- Weird issue where form field loses focus to previous form field even with JS disabled
- Display custom-post type based on the Title matching the current selected value
- WordPress/Javascript form not working on custom post type single posts
- WordPress custom post type numeric pagination with ajax
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- Ajax Post Filter | Split Taxonomy Into minPrice & maxPrice
- How can I put content before my custom post type default pages?
- WP_Insert_Post creating duplicate posts when logged in
- How to filter custom post type by multiple Taxonomies
- How to filter custom post data with AJAX?
- Internal Server Error when echoing an OBJECT from wp ajax action function in functions.php to JS file
- Select posts from list and add them in a new list
- Load posts via AJAX without draft status
- Appointment booking system in WordPress
- Issues with Ajax Pagination and Filtering
- Hide load more button if no more post in selected category
- Get current post type within functions.php
- Search and filter terms of a custom post type only and display results