我输入了:
<input type="number" pattern="[0-9]*" min="1" max="20" name="kredai" class="form-control" placeholder="Kaina, eurais (privaloma)"></input>
我如何做,当客户填写此输入时,它将转到
http://some.web/cost.php?kredai=5
(其中5是来自输入的值)并显示来自cost.php的结果输入?
抱歉我的英语。答案 0 :(得分:0)
好的,我找到了解决方案:
HTML:
<input type="number" pattern="[0-9]*" min="1" name="kredai" id="kredai" class="form-control" placeholder="Kaina, eurais (privaloma)"></input>
JavaScript的:
$('#kredai').on('input',function(e){
var value = "./assets/cost.php?cost=" + $("#kredai").val();
$.get( value, function( data ) {
$( ".result" ).html( data );
});
});
感谢大家的帮助!
答案 1 :(得分:-2)
<input type="number" pattern="[0-9]*" min="1" max="20" name="kredai" class="form-control" placeholder="Kaina, eurais (privaloma)" action="cost.php" method="get"></input>
并在cost.php文件中:
$kredai = $_GET['kredai'];