html:
<form class="form-horizontal" role="form" autocomplete="off" action="" method="POST" name="formular_comanda" id="formular_comanda">
<input type="number" class="form-control input-sm" name="inaltime_best" id="inaltime_best" placeholder="H (mm)" required="required" onchange="calculator_piese()" />
</form>
JS:
function calculator_piese() {
var height = document.getElementById("inaltime_best");
$.ajax({
type: "POST",
url: "calculator/panouri-simple/calcul-panouri-simple.php",
data: $("#formular_comanda").serialize(),
success: function(result) {
document.getElementById("show_panels").innerHTML = result;
console.log(height.value); // this return my input value
},
error: function(result) {
console.log("Eroare:");
console.log(result);
console.log();
}
});
}
calcul-panouri-simple.php
error_reporting(E_ALL);
$height = $_POST['height'];
var_dump($height); //this returns NULL
I have a problem. My php returns error:
Notice: Undefined index: height in ... calcul-panouri-simple.php on line 3
console.log(height.value)
returns me the value, but from php var_dump
i get NULL
.
I don't understand what is wrong.