[英]unable to shift numeric values from Javascript to php,not using <form>
This value of count is to be transferred to the php page orderdetail.php This is the javascript code that i am using,Please provide the solution. 此count的值将被传输到php页面orderdetail.php。这是我正在使用的javascript代码,请提供解决方案。
var count=10; $.post('orderdetail.php',{no_of_orders:count},function(){});
The php code i am using is 我正在使用的php代码是
<?php
$no_of_orders=$_POST['no_of_orders'];
echo $no_of_orders;
?>
您为什么不只使用php而不是为此目的而包含javascript?
Using jQuery to set the value of the input field with the id myVal .
使用jQuery设置id为myVal的输入字段的值 。 Then you can send the value with the Form
然后您可以使用表格发送值
JS/jQuery CODE JS / jQuery代码
var count=10;
$('#myVal').val(count);
HTML/PHP CODE HTML / PHP代码
<form action="orderdetail.php" method="POST">
<input type="hidden" value="" id="myVal" />
<input type="submit" value="Submit">
</form>
Hope this helps 希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.