Я искал рекомендованные вопросы, и мой код, кажется, правильный, но он
Вот мой HTML-код сначала с внедренным кодом JS
<form>
<input id="inhalt" type="text" name="eingabe">
<button type="button" id="button" value="bestätigen">Transfer</button>
</form>
<script>
$('#button').click(function(){
var variableAjax = $('#inhalt').val();
console.log(variableAjax);
$.ajax({
type:"POST",
url: "html.php",
data: {
variableAjax : variableAjax,
},
success: function(data){
console.log("hallo"+data);
}
});
});
</script>
Сайт PHP
<?php
if(!empty($_POST['variableAjax'])){
$name = mysqli_real_escape_string($_POST['variableAjax']);
}
var_dump($name);
?>
Консоль браузера. Я вижу введенное значение. Я также ввел требуемый cdn
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
У меня также есть следующая информация в сети моего браузера
304
GET
localhost html.html?eingabe=dfadfads document html Aus Cache 833 B
304
GET
ajax.googleapis.com jquery.min.js script js Aus Cache 0 B
200
GET
localhost favicon.ico img x-icon Aus Cache 30,17 KB
200
POST
localhost html.php
На сайте PHPЯ получаю эту информацию
Notice: Undefined variable: name in C:\xampp\htdocs\dashboard\YOUTUBE\TEST\html.php on line 8
NULL