This is a shipping calculation. The user selects their ship type (ground, next day, etc) via a drop down that triggers the ajax to pull the shipping amount and recalculates the total on my checkout page. The ajax is calculating and displaying correctly now I need my form to take the x_amount value and set it to my php variable $total so I can post this amount to the payment gateway.
Is that a little more clear? Basically, I am wanting to do this:
<?php $total ?> = <script> x_amount</script>
Obviously this doesn't work, but is the only way I can think of illustrating what I need to happen.
~A2S
Main Topics
Browse All Topics





by: rdivilbissPosted on 2007-03-30 at 15:10:16ID: 18826815
PHP runs server side. It is finished executing once your javascript executes. So if you made a calculation on the clinet side you need to post it back to the server before PHP can see the value.
Are you wanting to send the value back to the server with AJAX?