• Resolved Gerald

    (@gerital)


    I try to use the ea_new_app_from_customer hook which is triggered when a new appointment is booked, but get the following error message from bootstrap.js:848:17 in the browser:

    TypeError: response.responseJSON is undefined

    So it seems that the hook needs to return a JSON, I tried to do the following but without success:

    add_action( 'ea_new_app_from_customer', 'custom_callback_function', 10, 2 );
    
    function custom_callback_function( $appointment_id, $appointment_data ) {
       // do stuff here
    
       //return $appointment_data;
       return json_encode($appointment_data);
    }

    How should the return statement look like?

Viewing 1 replies (of 1 total)
  • Thread Starter Gerald

    (@gerital)

    I tried to print the $appointment_data and the above error message comes from print_r($appointment_data); which seems to destroy the JSON returned to calendar.

    So finally I print the data using this statement:

    error_log(urldecode(http_build_query($appointment_data)));

Viewing 1 replies (of 1 total)
  • The topic ‘How to use new appointment hook’ is closed to new replies.