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
- How to enqueue scripts on custom post add/edit pages?
- Updating custom post meta with ajax
- Favouriting a Custom Post Type
- WordPress post sorting with AJAX
- Prevent reload confirmation after AJAX save
- 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
- 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
- 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?
- Ajax Custom Post Filter is not filtering
- WP_Query inside foreach loop returning same value for all options when filtered using ajax
- Custom post type – use ajax to display sub pages
- 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?
- 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
- Multiple wp_editor instances in custom post type using Ajax
- Loading multiple post content in FancyBox
- 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
- Not saving custom taxonomy while using ajax
- Search for custom field input of a custom post type in ajax live search
- URL issue retrieving Custom Post Types using Backbone JS API
- Filtering posts based on three taxonomies
- WordPress next post by ajax call on button click
- Trying to list years (for a filter) but not all years display
- How can I use javascript in specific posts without relying on a plugin?
- How can I create a button that when clicked populates a div with a list of foods that are checked as a certain type of ACF?
- How to use posts as tabs in a custom page?
- Attend event form with ajax
- Hide the update button from edit view in wordpress custom post type
- localize_script or rest api
- dynamic vue widget inside custom post
- How to display custom post type pagination buttons when processing AJAX request
- My post loop needs to have 8 different post templates
- Show ajax form resuslts in page
- Dropwdown: Get taxonomy terms from posts that share preselected terms from 3 other taxonomies
- Is there a best practice, or typical way to do AJAX updating for data on a custom admin screen or post.php?
- Filtering custom post using Ajax and taxonomies, keep getting 0
- How to make sure, that only the selected post is changing?
- Fetch loop of custom post types with AJAX
- Collect custom post in a calendar
- Redirect sub-page URLs to parent without changing URL
- Calling in Post Content via AJAX
- Submitting custom post from frontend,jQuery ajax, and custom validation – can’t find proper place to insert wp_insert_post()
- How to load more custom type posts through AJAX & LOAD MORE POSTS button
- Updating custom post meta with ajax
- Custom filtering on month value only of an entire date field
- Loops running into each other
- 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