I have a a select box on my PHP file. Each time I select a value , several values are being retrieved
from MySQL.
I'm interested in calculating the value of one field called amount .
Namely, I want to have on the same page a variable that will add the new retrieved amount to the current SUM , calculate and present the total amount.
Each time I select a different value , current amount is being presented and the variable holds the total amount is being updated as well.
As I mentioned in the title, records are being retrieved using Ajax.
How can I achieve this ?
Echo calculated values retrieved by the ajax function.
Moderator: General Moderators
- jimthunderbird
- Forum Contributor
- Posts: 147
- Joined: Tue Jul 04, 2006 3:59 am
- Location: San Francisco, CA
Re: Echo calculated values retrieved by the ajax function.
This should be relatively easy even without using AJAX. Just work on the onChange event handling in the selection box, use one global variable in javascript to hold the sum.
Re: Echo calculated values retrieved by the ajax function.
Hi jimthunderbird,
Since i'm newbie can you refer me to a simple example ?
Thanks
Since i'm newbie can you refer me to a simple example ?
Thanks