Adding And Subtracting With Javascript And Json
I have a t-shirt price form where you can select the garment, the color, add multiple locations and then some extra options. Im trying to figure out how to make it when you select
Solution 1:
First of all, i would recommend to do the calculation server side. You can use a simple webservice with one method that takes the number of shirts as the argument.
If you don't use a WCF service, you can deserialize the JSON argument with this library:
http://james.newtonking.com/pages/json-net.aspx
Do the calculation and send it back to the client. You can do this easily with jQuery as described here: http://api.jquery.com/jQuery.post/
Inside the success callback you can then manipulate your DOM to display the correct information.
Post a Comment for "Adding And Subtracting With Javascript And Json"