You have to use json_encode
to return data. Also use $_POST
instead of $POST
.
Please try the following code for the PHP part.
function printdata() {
$data = $_POST["req"];
echo json_encode($data);
}
if (isset($_POST["req"])) {
printdata();
} else {
echo 'No Data';
}
Related Posts:
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- How to use wp-ajax in wp-cron
- Shortcode button dosent work for all posts. Work for first post only
- wordpress add_action() issue in ajax call
- How to get specific string/value from an array? php [closed]
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Ajax call not working in wordpress through a plugin
- Calling PHP function with AJAX
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Conditional Fields depending on checkboxes
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- How do I convince this button to do something when it is clicked?
- How do I call an action hook into wp_ajax hook callback function
- How to extend WordPress Bookly plugin
- How to load wp_editor via AJAX
- How to call plugin path in JS?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How can I make content disappear when a user logs in?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- ‘Lazy loading’ list of posts with pagination
- Errors while using ajax from external wordpress page
- How to include admin-ajax when loading external javascript
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- How can I make the “Preview Post” button save and preview in the same window?
- Creating an Exit Confirmation Popup
- Difference between register_block_type & wp.blocks.registerBlockType
- How to create popup same as wordpress popup feature
- How to add pagination to wpbakery grid?
- WordPress Ajax Callback
- WordPress Plugin Page is Loading in Admin Content Container Instead of Separate Page
- WooCommerce get_price returning wrong price when used via ajax
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- add image crop function like in wp customizer
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- How to edit content before post update
- Ajax call returning 0
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- admin-ajax.php warning max input vars exceeded on layered pop plugins [closed]
- How to load wp_editor via AJAX
- Using color picker in plugin, does input attribute order matter?
- Using TinyMCE in plugin?
- Using window.onload with Ubermenu
- Redirect to another page using contact form 7? [closed]
- Call plugin with php function
- JavaScript in a PHP plugin
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- Pass user role to javascript code inside body
- get specific value of a array | PHP
- Background Music WP [closed]
- Asynchronous request in wordpress
- How to use custom Javascript code inside a plugin?
- Adding a simple Javascript file with a plugin
- Passing PHP Variables to AJAX Loaded Pages
- Social share buttons text shows up on post excerpts
- Plugin Admin panel checkbox unchecked after submit
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- Custom Plugin scripts from admin working in frontend
- Code for unique user visit count on every page WordPress
- How do I reinit WordPress plugins dynamically using jS?
- How can I adjust my function so the page editor still loads in the backend?
- Possible way of having multiple Gutenberg instances for a page?
- Trouble with AJAX using GET
- Woocommerce add products to cart
- In a plugin, How to update a json file using ajax
- Why does my custom plugin only function correctly once per page?
- How to get a specific string from a url
- JS working when used normally but not in wordpress
- How can I create a secure file download in WordPress?
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- How to avoid the 403 Forbidden error in a WP Plugin with Ajax and PHP
- Problem with wordpress has_action() function
- Custom Field used to allow a Free Story; no longer works
- Create a form and have custom menu display based on user answers?
- Woocommerce – Change variations output
- How to disable/enable PHP plugin functionality based on a TinyMCE toggle-button
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- Ajax call to php function doesn’t work PHP code
- Compare Ajax Data Results
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- My ajax request don´t work and return 0
- WordPress environment not loading properly
- Creating new option (add_option) from AJAX – Settings API
- How to create a dashboard for logged-in users with custom functionality? [closed]
- Creating a user ‘add custom field’ section
- Javascript not working
- AJAX doesn’t pass variables to the php function in the plugin
- display user input using ajax in wordpress
- Can’t insert files in other inputs
- Response from Php File to Ajax is not getting sent
- Help me with my first very basic plugin
- How do I output user_registered time in my correct timezone?
- Load css classes after using ajax calls
- How to tweak a plugin without preventing it from updating
- How to create post comparison in wordpress
- Adding a script & php to functions.php
- how to show selected options drop down menu values in attributes field in after saving post.php
- Refresh server side rendered block in Gutenberg without changing attributes or its content