Result from wp_send_json adds line feed

Well that was tricky. This was the offending code that was generated a line feed to the response.

add_action('wp_ajax_nopriv_display_event_info', 'DisplayEventInfoBox');
?>

<?php
function displayStepHeader($isValid, $pos)

I changed it to

add_action('wp_ajax_nopriv_display_event_info', 'DisplayEventInfoBox');

function displayStepHeader($isValid, $pos)

and all is well. I have no idea why that was an issue but how I tracked it down may be useful for someone else. I simply put echo ‘a’; between the function definitions until the first character I received was an ‘a’ and not char 10 (line feed).

This was also caused “Warning: Cannot modify header information – headers already sent” because the first character sometimes wasn’t < but a line feed.

Hopes this helps someone else out one day…