The WordPress Plugin Developer Handbook has background info and code samples of how to use Ajax in your plugin (and themes). Give it a read and it should get you on the right path.
Related Posts:
- Using Ajax with a Class file
- SSL breaks customizer: page isn’t returned from ajax
- Stop admin-ajax?
- Is it safe to assume that a nonce may be validated more than once?
- How to verify nonce from Bulk/Quick Edit in save_post?
- store/cache ajax sent data to avoid repeated request
- wp_ajax_[service] returning 0
- Trying to load content of a post via AJAX
- Insert Post using Ajax
- How can I automatically login using a URL?
- Run again current query via ajax but changing a var
- Ajax function returns -1
- Problems with creating sortable sections in customizer
- Quick Edit: Selected Custom Taxonomy Not Refreshing After Save
- Filter WP user acf field by ajax
- Ajax Request not coming back to class
- wp_verify_nonce always returns false when logged in as admin
- How to make ajax content indexable by search engines?
- Ajax requests with different WordPress Address and Site Address setup
- AJAX requests broken due to HTTPS for wp-admin
- query vars in url work but not in ajax call
- is_home doesn’t affect content
- How to declare a JS variable in an AJAX call
- is_page() conditional not working inside an AJAX function
- How to check an ajax nonce in PHP
- jQuery Ajax passing empty parameters to my function?
- admin-ajax.php slows down, but cant figure out which plugin
- Convert this relative path to absolute
- Load WP content with ajax less server demanding and faster than normal page loading?
- how to send Ajax request in wordpress backend
- admin-ajax.php slow website, how to fix
- WP Admin AJAX Security – using POST to include a relative URL
- Admin-ajax.php 400 error
- ajax nonce verification failing
- admin-ajax.php ” Missing argument 2″ warning
- Update get_pages using ajax on form select change
- Is there builtin way to use protected AJAX endpoint?
- How to create an ajax endpoint without js?
- AJAX Load more on CPT returning random posts
- get_queried_object_id in AJAX
- Should I check for privileges before hooking into `wp_ajax_$handle` or after?
- How to load content from many posts on a page, only if needed
- Making an ajax request from a different domain
- Images loading over http instead of https
- Ajaxify Form That Submits To Same Page To Display Post Data [closed]
- Pagination Using ajax
- wp_ajax_ works fine but wp_ajax_nopriv_ returns HTML and not calling function
- Why is wp_localize_script returning false?
- Change header.php after ajax call
- What’s the latest I can hook into wp_ajax_%?
- Retrieve JSON file from JS trough php
- WordPress – admin-ajax.php returns 502 Bad Gateway [closed]
- Using admin-ajax prevents regular php form submission
- How to use ajax to get multiple outputs?
- Sql formatting for post data within function
- WordPress is creating nonce as a logged in user but verifying it incorrectly
- get current taxonomy post with ajax
- WordPress Ajax Filter
- wp_ajax handler with multiple class instances
- admin-ajax.php (aborted) error when using jQuery.get
- Storing temporary data for a custom post type
- I get a 0 after the result of my ajax requests
- Not getting an ajax readystatechange on my page
- problem using ajax url
- Problems implementing Load More functionality
- admin-ajax.php error 500
- How to display contact form 7 form in vanilla js without jquery in frontend
- Error sending array data from php to javascript
- Add ajax to plugin in admin area
- Search live Ajax
- Ajax login fails: script sets cookies, but is_user_logged_in() returns false
- Using wp_send_json_success instead of $result[‘message’], die, etc
- do_action won’t work in ajax callback
- Opening Modal popup on Ajax form submission
- 400 Bad request while submitting form using AJAX
- AJAX POST Value not being returned – WordPress – AutoTrader API
- Its possible to ajax update the content of the admin custom post type list
- WordPress custom ajax login not working on mobile browsers
- Failed to load resource: the server responded with a status of 404 (Not Found) admin-ajax.php
- Ajax call on class returns old data
- how to enable ajax on submitting of contact form 7?
- Create a post with REST API and adding a category
- delete post meta data in array WordPress
- Using AJAX on Contact-form the WordPress way
- Retrieve Header Background Image with AJAX
- Error while submitting form using AJAX and php
- AJAX call in backend results in empty update_option
- Ajax Comment: Page reloads whenever the comment submission form is reloaded
- How to fetch meta_value and meta_key in matrix after ajax request by post_id
- get_comments() returns empty array if called through AJAX
- register_setting and AJAX?
- How to get parent comment’s id?
- Static var overwritten with WP AJAX action, works fine without AJAX
- ajax response is 0 instead of ‘script’ [duplicate]
- A refreshless WordPress website
- Dynamic dependent select box getting null value
- get_template_part() does not render after the ajax request
- How to get data with Select AJAX PHP
- Bad Request 400… jQuery ajax post of json data to wordpress admin-ajax.php
- At what stage does wp_ajax hooks gets applied during WordPress request?