Use the WP JSON REST API in conjunction with jQuery.ajax(). It works pretty well with custom endpoints. Just be sure to use nonces.
<?php
add_action( 'rest_api_init', function () {
register_rest_route( 'myplugin/v1', '/author/(?P<id>\d+)', array(
'methods' => 'GET',
'callback' => 'my_awesome_func',
) );
} );
Related Posts:
- How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with WordPress 3.0 and up?
- Simple rich text editor in Text widget?
- Content generator for development site [closed]
- Handling jQuery Component Collision
- Drag-and-drop “Panels”-style visual layout editor?
- Let readers suggest edits from the frontend
- How to restrict Front-End Editor on a page?
- Some way to Flush or Overwrite all Imported Content in a Site for a Fresh Import – How?
- How to notify users of blog updates a la Admin Plugin Update notifications?
- Using rewrite rule to access a view of a plugin from home page
- Is there a way to share content amongst wordpress sites
- Restrict backend but allow to use post.php?action=delete&post=POSTID from front-end
- Datepicker not supporting timepicker
- Frontend editing, Frontend user dashboard
- Capitalize All Titles and Headlines in Chicago Style
- plugings request url is the old url
- Handling jQuery Component Collision
- Next and/or previous post content
- Can we use a webservice with WordPress?
- Collapse content [closed]
- Can I use a plugin for a singular page on my website?
- Preview featured image using frontend post plugin
- Implement Autocomplete for a custom field on WordPress Plugin Frontend
- How to add a full edit link to front-end editor?
- Show an image in my header.php
- How to remove the inline styles from the content of a WYSIWYG editor field at the time of saving the post?
- ob_start() combined with wp_query
- Wysiwyg editor errors
- How to add wp visual editor in a custom widget?
- Unable to add TAB character to post?
- How to call plugin functions in a custom template
- Add script into front from my plugin
- Fullscreen Video/GIF Intro
- AJAX on Front-End Button Click not working – Custom Plugin
- How to handle WordPress Plugin Front-end AJAX Call [duplicate]
- Front-end CSS Library for plugin [closed]
- Insert Message before content of after title
- Add Content to Content()
- Timed content and flagging content as viewed by user?
- Why are my WordPress store items showing up in duplicates?
- plugin wraps the entire content
- How to do the simplest possible frontend ajax call from a plugin?
- Enqueue script: link not working in page source
- Get post content from outside the loop with plugin shortcode usability
- How to request admin-ajax.php correctly when wordpress URL and site URL are different?
- How to auto strip hyperlinks & images in wordpress post
- Create a link which allows visitors to disable a plugin?
- Categories from front-end, checkbox selection doesn’t work
- Is there a way to keep youtube videos from displaying on home page, and display only on single posts?
- Filtered content appears in the excerpt
- Is there existing plugins to “Click-to-Launch” embedded Flash / SWF content?
- Plugin for visitors to edit content without logging in? [closed]
- Effeciently adding Checkboxes to TablePress table cells
- Restrict posts to customers with complete WooCommerce orders only
- Push Contact form 7 variable to front end after submission
- Multisite – Cloning CPT pages + content (including ACF Flexible Content) from site to site
- Displaying different content depending on variable
- Adding shortcodes to multiple pages with function
- How can I add a custom Javascript snippet to display my feedback in footer?
- Images are broken in Wysiwyg Editor – ACF backend
- Tool to highlight text in WordPress page and provide additional text on hover
- How can I change page content for good once a button is pressed?
- WordPress User profile with Avatar upload on the front end without plugin?
- Content disappears when searching with Search & Filter plugin
- WordPress website working fine on localhost but not displaying front pages on webhost
- How To Toggle User_Meta in frontend in a form using PHP
- How is it possible to create Multi part sections where people can answer or comment or vote on various parts of a page’s content as given example?
- Unset plugins on front-end belonging to specific category
- How to fix blog article view and share #’s?
- Copying content from my other websites
- How to upload PDF from Front-End and post automatically?
- What action or filter can I use to change all the html returned from server for a page?
- Front End Page Not Loading Header Footer
- What action/hook do I need to register to have my plugin handle front-end editing?
- ‘Easy Template Path Hints’ for WordPress?
- Why doesn’t a form need an ‘action’ with a plugin that uses the post data?
- How to add featured image on front end form?
- custom template only for content
- How to hook into search results template or query?
- AJAX doesn’t pass variables to the php function in the plugin
- Working on fixing wp-front-end-editor, encountering undefined index
- How to create custom content on custom page from plugin?
- Carrying information from button click into form [closed]
- Contents are missing but shown when switching to another theme in wordpress
- Get content or excerpt of top rated votes @GD-Star Rating? [closed]
- How do I add php to all links automatically?
- is ther a plugin that will hide/show content for a scheduled period of time? [closed]
- Get a submitted value from front end post form for single template
- Add a filter to a different custom plugin
- What is the correct method for updating post content from a plugin?
- WordPress User Frontend Editing Custom Fields
- Single dash converted to double dash
- map urls to plugins
- My page content doesn’t show up
- How to output cmb2 wysiwyg by using timber
- Distribute post content through several divs [closed]
- Shortcode returning specific content of a post
- Change page content based on dropdown selection
- Auto-scroll to beginning of accordion item
- Display Any Field fromAdmin Panel in Frontend via Shortcode?