infodigger
asked on
Pass a value from javascript to c#
I need to retrieve a value calculated using javascript back to my c# code.
The javascript code is here:
function calculateShipping(){
var numberTotal = new NumberFormat( parseFloat(Shipping.value) + parseFloat(subTotal) );
numberTotal.setPlaces(2);
totalPrice.innerHTML = baseCurrency + numberTotal.toFormatted();
}
I need to pass the numerTotal back to c# when an imagebutton is clicked on a page.
Thanks!!
The javascript code is here:
function calculateShipping(){
var numberTotal = new NumberFormat( parseFloat(Shipping.value)
numberTotal.setPlaces(2);
totalPrice.innerHTML = baseCurrency + numberTotal.toFormatted();
}
I need to pass the numerTotal back to c# when an imagebutton is clicked on a page.
Thanks!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
And after further reading Zvonko's reply, I see her mentioned the same thing... sorry Zvonko :o)
No problem :)
ASKER
Thank you all for your help!
You are welcome.
Make AJAX call a page, eg:
www.yoursite.com/getvalue.aspx?myvalue=1234
Where:
"getvalue.aspx" is a c# page to retreive your JS value
"myvalue" is the POST variable to hold your value
"1234" is your POST value
Have AJAX call that page, but do not bother to display it. I do this method with PHP quite often, if you like I can pull out the code I use for this to help you along.
Hope that helps.