On line 252 you are using print_r()
inside your code, which is printing out an error message before the proper response, so your response is not valid JSON anymore.
If, as it appears, you want to include the output of print_r()
in your error log, and not include it in the response, you need to set the second argument so that the value of print_r()
is returned, and not printed:
error_log( "get_detail =" . print_r( $data, true ) );
Related Posts:
- How to: Rest endpoint returning empty object
- get all products of one category
- How can I pass get_the_author_meta(‘user_email’) through the REST API?
- Create a new post using rest api and save featured image using an external image url
- How to do admin ajax request in a plugin for rest api
- ajax response strips multidimensional array and unable to decode
- Is it possible to make WordPress as a RESTful app?
- oneOf two possible objects in WP REST API?
- AJAX form post returns 0
- rest_no_route on custom API endpoint wordpress
- Update Data parameter of a wp_localize_script() call
- jquery & ajax sending data to php
- wp_localize_script is not adding a global variable for javascript
- json_decode does not work on WordPress
- wordpress is adding a second backslash when I use addslashes
- Can’t get AJAX call working in custom plugin
- Custom Rest Endpoint: Post/Put/Patch not working
- Bad Request in AJAX
- Remove entire [$key] from array stored in custom field using Ajax – unset($array[$key]); not working
- 400 Bad Request, in wordpress theme development, wp_ajax
- Ajax is not working in a loop
- merge wp rest api query to get posts per category does not work
- ajax recursive calls on wordpress returning answers outsite the function scope
- Ajax submit result opens in admin-ajax.php
- WordPress debug messages not displaying
- Are there any security risks when submitting data-attribute data through AJAX?
- insert query on a custom table using ajax with jQuery plugin Jeditable
- How to get error object returned by wp_create_user
- Plugin AJAX Save to Custom Table
- Can’t retrieve body params from PUT endpoint using formdata
- Ajax: Populate with content from a post’s ID not working – duplicating current page html instead
- Data not insert and update through ajax and jQuery in admin page?
- Setting a JSON web token from a secondary api as a secure cookie on WordPress
- WP ajax requests not stacking?
- Do I need to create an endpoint?
- WordPress Rest API with rest_do_request, possible race condition?
- How to use apiFetch to get author information in Gutenberg properly?
- How do I get rid of my inclusion race-condition on wp_enqueue_script
- Issues Updating Post Meta with AJAX (Seems simple but cannot figure it out)
- Mock a dependency of a WP_REST_Controller class
- update_callback is not working in register_rest_field
- REST Endpoint API 404
- AJAX button with success callback. (Titan Framework)
- ajax working when function is on child theme but not in plugin page
- AJAX call to admin-ajax.php by subscriber returns home page
- Custom Post Type Object – Undefined Variables
- Reporting errors in a shortcode plugin
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- Ajax function is not working on WordPress
- About a programming language starts with [closed]
- Best practice for plugin: always detect admin-ajax call?
- Plugin Development: Storing and Manipulating Data That Fits JSON in Database
- add_action wp_ajax_ not loading in plugin file WP Network
- Why is the form not updating when I select a new sector from the list?
- What might be the reason of Couldn’t fetch mysqli_result on another domain?
- Workflow for new importer plugin – your advices?
- Plugin Form Submitting to admin-ajax.php instead of admin-post.php
- Plugin can’t be activated [closed]
- How do I debug an error that a plugin is causing?
- Ajax +wordpress onClick link redirect to new page and create html content
- AJAX request not routing through proxy
- Need Help Determining Where Header Error is Happening
- “Rendering of admin template [path to template] failed”
- Is there any way to pass messages from a script to a redirect target in a hidden fashion?
- Get cat parameter from admin-ajax
- How to write a shopping queue line plugin with a queue button?
- WordPress (pagenow link) in ajaxurl change after i change plugin language
- Import images remotly run through timeout error
- Allow REST API Endpoint to specific user and hide from public
- Ajax on the Administration Side of plugin – returns 0
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- wc_get_template_part doesnt display the content [duplicate]
- Showing results from json-string in WordPress search results page
- Attaching Image-file to userId
- Ajax action has 200 status but response of No response data available for this request
- Jquery php request is returning a weird result
- WordPress Does not grab the string sends useing AJAX response, wp_ajax hook
- Error code when migrate
- Query String Filtering API
- Posts form with AJAX request – Plugin development
- WPGut – Updating failed and shortcode?
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- How to control ajax calls without effecting memory of server?
- How to query a nested field in wordpress api using _fields param
- Bad request 400 using class based files
- Get Custom taxonomy parent with wordpress REST API
- register_meta not showing custom post type metabox data in rest api
- Forbidden Error in ajax call with wordpress
- why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function
- Trying to run a Ajax request from a checkout form in woocommerce via a custom plugin
- “add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar
- Securing custom rest API endpoints with public access from PWA
- ajax stopped working when not logged in wordpress
- WP_Query not ordering correctly
- ajax call return 406 not acceptable for non logged users only
- Does $this context change in an AJAX callback?
- 403 error rest_’cookie_invalid_nonce’ on API Request
- How to use Datatable with Ajax when creating plugin on WordPress?
- WP_Fatal_Error_Handler OR WP_Error OR try/catch
- Adding Amchart Interface to WordPress API