N
N
novosib2018-05-07 12:18:23
CRM
novosib, 2018-05-07 12:18:23

How to create a form without action?

Hello, tell me please.
How to create a form without action?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrew, 2018-05-07
@KickeRockK

<form>
</form>

L
Lander, 2018-05-07
@usdglander

Judging by the fact that the question sounds like an idiot, I dare to assume that you need ajax processing of form submission.

<form id="form_id">
...
<button type="submit">Отправить</button>
</form>

in js (via jQuery):
$('#form_id').on('submit', function(e) {
    e.preventDeault();
    $.post('url_to_handler_action', $( this ).serialize(), function(data) {
        alert('Форма отправлена без перезагрузки страницы').
    });
    return false;
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question