Answer the question
In order to leave comments, you need to log in
Why is the form not being submitted and $_POST is empty?
Hello everyone, I can't understand why the form is not submitted and $_POST is empty, help:
Here, JS:
<script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
function ask() {
var s = confirm("Вы уверены?");
if(s) {
document.forms['form'].submit();
}
}
$(document).ready(function () {
$("form").submit(function () {
var formID = $(this).attr('id');
var formNm = $('#' + formID);
var message = $(formNm).find(".msgs");
$.ajax({
type: "POST",
url: 'dashboard.php',
data: formNm.serialize(),
success: function (data) {
// Вывод сообщения об успешной отправке
message.html(data);
},
error: function (jqXHR, text, error) {
// Вывод сообщения об ошибке отправки
message.html(error);
}
});
return false;
});
});
</script>
<form id="delete_row" class="form" autocomplete="off">
<?php foreach ($array as $row): ?>
<tr class="row_tr">
<td class="row_td"><?php echo $row['id'] ?></td>
<td class="row_td"><?php echo $row['referer_url'] ?></td>
<td class="row_td"><?php echo $row['utm_source'] ?></td>
<td class="row_td"><?php echo $row['utm_medium'] ?></td>
<td class="row_td"><?php echo $row['utm_campaign'] ?></td>
<td class="row_td"><?php echo $row['utm_term'] ?></td>
<td class="row_td"><?php echo $row['utm_content'] ?></td>
<td class="row_td"><?php echo $row['type'] ?></td>
<td class="row_td"><?php echo $row['source'] ?></td>
<td class="row_td"><?php echo $row['group'] ?></td>
<td class="row_td"><?php echo $row['utm'] ?></td>
<td class="row_td"><?php echo $row['ref'] ?></td>
<td class="row_td"><?php echo $row['cost'] ?></td>
<td class="row_td"><?php echo $row['date_inserted'] ?></td>
<input name="row_del_id" class="formInfo" type="hidden" value="<?php echo $row['id'] ?>">
<td class="row_td"><input type="submit" class="formBtn" name="delete_r" value="Удалить" onclick="ask(); return false;"></td>
</tr>
<?php endforeach; ?>
</form>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question