I have two files, one runs calculations in PHP once and stores them into variables in javascript. The second file holds mySQL query to be sent to database. How can I send the javascript variables from the first file, too the second file and store them as variables.
-I am loading the second .php file using a .load() function. So it is not refreshing and re- directing to the second .php file.
Is this possible to do with out ajax? If it is only possible with ajax, how do you set it up (new to ajax) ?
$("#st").click(function()
{
var s = $("#st").val();
var a = $("#AA").val();
var t = ((s*1)*(a*1)+(a*1)*(1/3)).toFixed(2);
var c = (t*95).toFixed(2);
var text = $('#st').children("option:selected").text();
document.getElementById('Tim').innerHTML ='<p>'+ t +' </p>';
document.getElementById('Obj').innerHTML ='<p>'+ text +'</p>';
document.getElementById('Tot').innerHTML ='<p>$'+ c +'</p>';
});
var Customer = <?php echo json_encode($q);?>;
var Dr= <?php echo json_encode($o);?>;
var Pd = <?php echo json_encode($p);?>;
var Qp = <?php echo json_encode($a);?>;
var Qs = <?php echo json_encode($r);?>;
var Cam = <?php
if($Camera==1){
$CameraOutput = "XL";
echo "XL";
}
if($Camera==2){
$CameraOutput = "SL";
echo "SL";
}
?>;