html - How can I define a jquery var to a php variable? -


i have simple question i've been looking , workin on awhile , can't seem it. heres code.

<script>   function calculate() {     var total = (parseint($('#studenttut option:selected').val()) + parseint($('#campusrb>option:selected').val())) * parseint($('#yearsatten>option:selected').val());     $("#total").html("<table width='100%'><tr><td>your calculated cost is: $" + total +"</td>" +     "<td align='right'>" +     "<?php $calculatedcost = " + total + ";" +     " ?>");      } </script> 

any suggestion on how can define jquery var php variable?

you cannot set jquery variable php .. since php server side code , javascript client side.... can use ajax send var server side.. or use form post var server... can use val() place value form..

 $('#inputid').val(total); 

and post form


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -