Всем привет, есть проблема, мне нужно передать из поля input текст, а php файл как-будто не видит её, попробовал var_dump($_POST), но там пустой массив. Делаю через ajax. HTML:
'''
<form action="index.php" method='get' id="form">
<input type="text" class="h" name="comment" id="comment">
<input type="button" id="y" class="bron">
</form>
'''
PHP:
'''
session_start();
include 'index.html';
$connect = new PDO("mysql:host=localhost; dbname=resto; charset=UTF8", 'root', 'root');
error_reporting(E_ALL);
ini_set("display_errors", 1);
$connect->query("UPDATE `resto`.`stol` SET `stol1`= 1 WHERE 1");
if(isset($_POST['comment'])){
$r = $_POST['comment'];
echo $r;
var_dump($_POST);
}
'''
JS:
'''
$(document).ready(function() {
// $('.h').hide();
$('.kv').mouseover(function(){
$(this).css('border','0.3vw solid red');
$(this).html('Столик занят');
})
$('.kv').mouseout(function(){
$(this).css('border','0.3vw solid #d4cc70');
$(this).html('');
$(this).css('top','-3vw');
})
$('.bron').on('click', function(){
var comment = $('comment').val();
$.ajax({
method: "POST",
url: "index.php",
data: {
comment: comment,
}
})
})
});
'''