Answer the question
In order to leave comments, you need to log in
How to send data from html form via ajax jquery?
<form method="post" action="#" id="ajax_form" action="">
<div class="row">
<div class="col-6 col-12-mobile">
<input type="text" name="email" placeholder="Email" />
</div>
<div class="col-6 col-12-mobile">
<input type="password" name="password" placeholder="Пароль" />
</div>
<div class="col-12">
<input type="button" id="btn" value="Регистрация" />
</div>
</div>
</form>
Answer the question
In order to leave comments, you need to log in
The question is really elementary. But since you have tried a hundred times, we will try to help you.
First, include jquery.
Then try like this -
let form = $('#ajax_form').
$.ajax({
url: form.attr('action'),
type: "POST",
data: form.serialize(),
async: false,
success: function (data) {
console.log(data);
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question