Javascript 在php中访问java脚本变量值并插入数据库
这是我的javascript代码:Javascript 在php中访问java脚本变量值并插入数据库,javascript,php,Javascript,Php,这是我的javascript代码: var totalPrice=0; var x=parseInt(document.getElementById("amount").value)||0; var e = document.getElementById("currency"); var value = parseFloat(e.options[e.selectedIndex].value); var text = e.options[e.selectedInde
var totalPrice=0;
var x=parseInt(document.getElementById("amount").value)||0;
var e = document.getElementById("currency");
var value = parseFloat(e.options[e.selectedIndex].value);
var text = e.options[e.selectedIndex].text;
totalPrice=(x*value).toFixed(2);
document.getElementById("totalPrice").innerHTML="<h3>Total Price : "+totalPrice+" "+text+"</h3>";
var totalPrice=0;
var x=parseInt(document.getElementById(“amount”).value)| 0;
var e=document.getElementById(“货币”);
var value=parseFloat(e.options[e.selectedIndex].value);
var text=e.options[e.selectedIndex].text;
总价=(x*值).toFixed(2);
document.getElementById(“totalPrice”).innerHTML=“总价:+totalPrice+”“+text+”;
这是我的html代码:
<div id="totalPrice" name="totalPrice"></div>
我想在php变量中访问此变量var total price value。以何种方式?你在提交表格吗?您希望从PHP脚本中获得反馈吗?您是否了解表单提交和AJAX?请查看我的,它可能会解决您的疑问。