JSFiddle - React, Tailwind, and code Playground

JavaScript

$.ajax($form.attr('action'), {
	dataType: 'json',
  data: $form.serialize(),
  success: function() {
    $('.top_text').fadeIn().removeClass('red').text('Ваше сообщение успешно отправлено!');
  },
  error: function(xhr, status, error) {
  	$('.top_text').fadeIn().addClass('red').text('Произошла какая-то ошибка, загляните в консоль');
  	console.log(xhr);
    console.log(status);
    console.log(error);
  }
});