Skip to content

Commit

Permalink
use native wp_send_json
Browse files Browse the repository at this point in the history
instead of echo
  • Loading branch information
jdub233 committed Jul 10, 2017
1 parent d19b2df commit 9c8f581
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions bu-liaison-inquiry.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ function handle_liaison_inquiry() {
if ( ! wp_verify_nonce( $_REQUEST['liaison_inquiry_nonce'], 'liaison_inquiry' ) ) {
$return['status'] = 0;
$return['response'] = 'There was a problem with the form nonce, please reload the page';
echo json_encode( $return );
wp_send_json( $return );
return;
}

Expand All @@ -258,7 +258,7 @@ function handle_liaison_inquiry() {
if ( ! isset( $options['APIKey'] ) ) {
$return['status'] = 0;
$return['response'] = 'API Key missing';
echo json_encode( $return );
wp_send_json( $return );
return;
}

Expand All @@ -282,7 +282,7 @@ function handle_liaison_inquiry() {
$return['status'] = 0;
$return['response'] = 'Failed submitting to Liaison API. Please retry. Error: ' . $remote_submit->get_error_message();
error_log( sprintf( '%s: %s', __METHOD__, $return['response'] ) );
echo json_encode( $return );
wp_send_json( $return );
return;
}

Expand All @@ -297,7 +297,7 @@ function handle_liaison_inquiry() {
$return['data'] = ( isset( $resp->data ) ) ? $resp->data : '';

// Return a JSON encoded reply for the validation javascript.
echo json_encode( $return );
wp_send_json( $return );
}

/**
Expand Down

0 comments on commit 9c8f581

Please sign in to comment.