My form is like the one above:
<form id="calculator">
<input type="text" name="height" id="height"/>
<input type="text" name="inferiorPanel" id="inferiorPanel" readonly />
<button type="button" onclick="calculatePanels();">
</form>
Jquery script is the next one:
function calculatePanels() {
var Height = document.forms["calculator"]["height"].value;
$.ajax({
url: "includes/inferiorPanel.php",
success: function(result){
$("#inferiorPanel").val(result);
}});
}
And PHP code from inferiorPanel.php is:
<?php
$height = ????;
switch ($height) {
case ($height > 0 && $height <= 1845):
echo 615;
break;
case ($height > 1845 && $height <= 1980):
echo 495;
break;
case ($height > 1980 && $height <= 2100):
echo 495;
break;
case ($height > 2100 && $height <= 2220):
echo 495;
break;
case ($height > 2220 && $height <= 2340):
echo 615;
break;
case ($height > 2340 && $height <= 2460):
echo 615;
break;
case ($height > 2460 && $height <= 2475):
echo 495;
break;
case ($height > 2475 && $height <= 2595):
echo 615;
break;
case ($height > 2595 && $height <= 2715):
echo 615;
break;
case ($height > 2715 && $height <= 2835):
echo 615;
break;
case ($height > 2835 && $height <= 2955):
echo 615;
break;
case ($height > 2955 && $height <= 3000):
echo 615;
break;
}
My question is:
How to pass the variable height in PHP without using POST on Ajax, in order to show the result in input inferiorPanel?
I do not want to use <input type="submit" /> because will refresh the page