Trying to GET data with ajax from database and show in fullcalendar
There were a couple security issues and error checking that I did see. Try these: <?php add_action(‘wp_ajax_get_timeslot_data’, ‘get_timeslot_data’); add_action(‘wp_ajax_nopriv_get_timeslot_data’, ‘get_timeslot_data’); function get_timeslot_data() { if (!isset($_POST[‘activityId’]) || !ctype_digit($_POST[‘activityId’])) { wp_send_json_error(“Invalid activity ID”); } global $wpdb; $activity_id = intval($_POST[‘activityId’]); $table_name = $wpdb->prefix . ‘booking_seasons’; // Support custom table prefixes $result = $wpdb->get_row($wpdb->prepare(“SELECT timeslot_dates FROM $table_name WHERE id … Read more