Ecommerce Shopify WordPress Discussion

Ajax call showing data in console.log but not returning data [closed]

Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question. Closed yesterday. Improve this question I'm trying to work on a simple Ajax call and I'm unable to figure out what's gone wrong. The ajax call is successful but nothing is returning. When I console.log(response), it displays the JSON in my console though. I'm using fullcalendar library and Ajax call not returning a response to the events object Following is my action function written in functions.php file function get_order_events() { $args = array( 'status' => array('processing', 'completed', 'on-hold'), 'orderby' => 'date', 'limit' => -1, 'type' => 'shop_order', ); $customer_orders = wc_get_orders($args); $events = array(); foreach ($customer_orders as $order) { foreach ($order->get_items() as $item_id => $item_values) { $product_id =$item_values['product_id']; // Get start and end dates from post meta $start_date = wc_get_order_item_meta($item_id, 'Check-in', true); $end_date = wc_get_order_item_meta($item_id, 'Checkout', true); // Add event to the array $events[] = array( 'title' => get_the_title($product_id).' : Booked', 'start' => $start_date, 'end' => $end_date, ); } } // echo json_encode($events); wp_send_json_success($events); wp_die(); // return json_encode($events); } add_action('wp_ajax_get_order_events', 'get_order_events'); add_action('wp_ajax_nopriv_get_order_events', 'get_order_events'); Following is my js code var link = admin_object.ajax_url; $("#calendar").fullCalendar({ initialView: 'dayGridMonth', height: 650, events: function (_info, successCallback, failureCallback) { jQuery.ajax({ url: link, type: 'POST', // Use POST method dataType: 'json', data: { action: 'get_order_events' }, success: function (response) { console.log(; successCallback(; // $('#output').html(; }, error: function (error) { console.log("Error"); failureCallback(error); } }); } });
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.