@author I think $items = apply_filters( 'wpcf7_ajax_json_echo', $items, $result ); should be called at the very end, this way people would not be forced to have textarea.
Same behavior here.
I found in includes/controller.php line 99:
if ( wpcf7_is_xhr() ) {
@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
echo $echo;
} else {
@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
echo '<textarea>' . $echo . '</textarea>';
}
and this function
function wpcf7_is_xhr() {
if ( ! isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) )
return false;
return $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest';
}
This means the request from the form is not detected as an ajax one so it adds a textarea.
In my case I modified the ‘action’ url in the form to send the request to another domain that’s why it is not considered ajax I think.
-
This reply was modified 9 years, 7 months ago by Nikoune.