JSFiddle - React, Tailwind, and code Playground
HTML
<form class="ajax_form" action="ajax_mail.php" method="get">
<h2>Связаться с нами</h2>
<label>
<span>Ваше имя:</span>
<input type="text" name="uname" required/>
</label>
<label>
<span>Ваш телефон:</span>
<input type="text" name="phone" required/>
<input type="text" name="email" placeholder="mail" required/>
</label>
<label>
<span>Ваш город:</span>
<select name="city">
<option>Москва</option>
<option>С-Петербург</option>
</select>
</label>
<div class="button_wrap">
<button class="button btn_green" type="submit">Отправить заявку</button>
</div>
</form>
JavaScript
$(".ajax_form").on('submit', function(e) {
var formData = $(".ajax_form").serialize();
e.preventDefault();
$.ajax({
type: "GET",
url: "/echo/html/",
dataType: 'json',
data: formData
}).done(function() {
alert("Спасибо за заявку!");
});
});