我想在mysql查询中获取javascript变量。我使用了此代码,但未在查询中获取值。
echo "<script>
$('#customer_name').change(function(){
var cusno=$('#customer_id').val();
alert(cusno);";
$query="select id from invoice WHERE cus_id =('"+cusno+"') and `sale_type`
!= 1";
$cmd = mysqli_query($GLOBALS['conn'] ,$query);
$rowcount=mysqli_num_rows($cmd);
if($rowcount>0){
echo"
var AP=document.getElementById('test');
AP.innerHTML='Allocated Payment';
";
}
else{}
echo"
})";
</script>