Have you actually added this action through functions.php?
This might be of interest for you:
https://developer.wordpress.org/reference/hooks/wp_ajax_action/
in your case the php function needs to be added as a hook:
add_action('wp_ajax_fetch_data', 'DisplayInfo')
add_action('wp_ajax_nopriv_fetch_data', 'DisplayInfo')
Related Posts:
- How to call a PHP function with Ajax when the user clicks a button
- Delete row of custom table in WordPress using AJAX
- Updating a checkbox value to database for specific row in table
- Can’t get result from sql using ajax result
- Ajax insert or update data
- Creating an auto result search bar
- Ajax call in wordpress not working for subscriber user
- Sql formatting for post data within function
- Use AJAX in a WordPress Plugin to Get Data From Custom Database?
- WordPress ajax response save into database
- Counting Posts with multiple taxonomy and terms condition using MySQL and AJAX
- Not getting ajax success response on insert/update row to database
- AJAX is not submitting data to database
- AJAX call in backend results in empty update_option
- Ajax Form data is not posted back to the get_results()
- Can’t access data from database using AJAX
- Translating wordpress foreach to ajax
- $wpdb Ajax not redirecting to main page
- Adding custom fields to Wired Impact Volunteer Management Plugin
- Successful ajax call returns lots of whitespace and text of code with 0
- Using $.ajax getting 500 error
- jQuery’s .on() method combined with the submit event
- Why is die() used at the end of function that handles an Ajax request?
- Making my AJAX powered WordPress Crawlable
- Why is a 500 error generated by admin-ajax.php not going into the Apache error log?
- admin-ajax.php doesn’t work when using POST data and Axios
- Custom Form with Ajax
- How to process ajax requests correctly using ajax plugins
- Gutenberg – how to correctly perform ajax request on backend
- get_template_part execute with ajax
- How to add WordPress nonces to ajax request
- How is it possible that the function of the test page works, but it does not go live?
- jQuery Autocomplete not working with wp_localize_script
- Ajax returning correct data BUT at wrong place
- Creating a Front-end based User Search
- get_posts empty when called via Ajax
- admin-ajax.php mixed content
- WP-API and Basic Auth returning 403 on POST but not GET
- Is there a hook to process a backbone restful PUT request inside wordpress?
- Check if username exist with AJAX
- How to localized one js file for different actions?
- plugin ajax to external php file always return null
- json encode not work in wordpress
- wordpress and add actions to button by coding
- Get Author Post on author.php with AJAX
- Admin-Ajax Error
- Stop ajax listener from sending empty parameter to function
- Using wpdb without loading all plug-ins via wp-load.php
- AJAX and -1 response
- How to make registration form ajax?
- Specify ABSPATH in jQuery url
- 403 error When i send ajax request on WordPress website
- Ajax Call 400 Bad Request error with POST request but not with GET request
- While Ajax is working well, media upload isn’t showing the imagines
- How can I call an api before user login
- Problems with wordpress nonces in Ajax call
- Get post content and show it in a div
- why does not work ajax that add_action registered in wordpress
- How to get post from pure frontend AJAX (using only post ID)?
- Auto load subcategories content with ajax
- Multiple AJAX requests using the same ajax_object.ajaxurl
- Is there a better way to access transients using javascript
- Filter custom post types by custom field using AJAX
- How to perform a frontend HTTP call with AJAX when plugin save the new settings?
- Refresh loop of custom posts (div) after new post is published
- Use ajax request to load sidebar
- How to change request URL?
- Why the wp_localize_script() does not work correct in my case? ( /wp-admin/admin-ajax.php 400 (Bad Request) )
- Updating failed. The response is not a valid JSON response. specific to my browser when I include javascript in my html
- Should wordpress nonce be placed in html form or in javascript file
- Ajax call returning 0 in page template
- If I leave out the wp_die() in the testiframe function I get the ‘0’ appended to my output. If I put it in, the page w/ iframe linked to it crashes
- how to make sure js is enabled before executing php function
- jQuery AJAX url wit variable
- How to pass array from jQuery to PHP with AJAX in WordPress?
- Using existing ajax data that is loaded into page
- How to force the admin-ajax.php file to load over HTTPS?
- Unable to ajax request with meta_query
- get_body_class() in ajax envrionment
- Ajax WordPress pass post URLs
- How To Pass Theme Path In Javascript Ajax to Pass Id On another Page in WordPress Custom Page Template?
- AJAX action returning empty posts array?
- Infinite Scroll
- Cannot add multiple single images at once
- WordPress Ajax JSON success return no being recognized
- WordPress page content only in fancybox except direct click
- Ajax takes 10x as long as it should/could
- SHORTINIT and sessions
- How to use AJAX to check if user is still logged-in?
- Ajax navigation and scripts loaded only on certain pages
- Closing ajax function file with die() causes error and empty page
- How to load wordpress sidebar using AJAX [duplicate]
- using Ajax: call to undefined function get_option
- How To Pass Ajax Value to PHP Query?
- ajax for visitors wordpress
- PHP cookie not set within AJAX call
- WordPress Ajax send response on every iteration of a loop
- 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?