我需要在javascript函数中将javascript变量分配给php变量 这是我目前的代码
<script>
$(document).ready(function() {
$('#datashow').on('click', '#proceed', function(event) {
event.preventDefault();
$('#confirmView').hide();
$('#confirmView').show('slow');
var price = (document.getElementById("amount").value);
var pass = 'Htj3Q3Yp10718900415738';
var key = '<?php echo md5(microtime() . rand()); ?>';
var pass = pass.concat(key);
if (price != '') {
$("#amountLabel").text(price);
$("#PurchaseAmt").text(price);
var pass = pass.concat(price);
var pass = pass.concat('144');
<?php $enc = '<script> pass </script>'?>
var enc = '<?php echo base64_encode(pack('H*', sha1($enc)));?>'
$("#pass").text(enc);
}
else {
$("#amountLabel").text('0');
}
});
});
我的问题是如何将此var传递给$ enc?请帮帮我