There is a form with multiple inputs:
<form method="post" id="addForm"> input input input ... <button type="submit" class="btn btn-primary">Отправить</button> </form>
ajax:
$("#addForm").submit(function(event) { // Предотвращаем обычную отправку формы event.preventDefault(); $.post('add.php', $("#addForm").serialize(), function(data) { $('#result').html(data); }); });
Handler:
<? if($_SERVER['REQUEST_METHOD'] === 'POST'){ print_r($_POST); } ?>
The jquery.js file is included once. The handler displays the data array from the post request and only once, and in httpAnalyzer 'e displays two consecutive requests. What's wrong?