Bitcoin Forum
December 09, 2016, 05:51:39 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: JSON/webform nub question (exchanging psc to btc)  (Read 848 times)
frontlineassembly
Newbie
*
Offline Offline

Activity: 2


View Profile
April 23, 2011, 12:57:02 AM
 #1

i have a shitty form:

Code:
<script language="JavaScript">
<!--
function CalculateTotals(){
f=document.orderform;
f.total1.value=parseInt(f.qty1.value)*1.14;
f.total2.value=parseInt(f.qty2.value)*1.1;
f.total3.value=parseInt(f.qty3.value)*0.90;
f.total4.value=parseInt(f.qty4.value)*0.95;
f.grandtotal.value=parseInt(f.total1.value)
+parseInt(f.total2.value)
+parseInt(f.total3.value)
+parseInt(f.total4.value)-2;}
//-->
</script></head>
<body>
<form name="orderform" method="post" action="formprocessor">
<table border="3"><tr>
<th>Amount</th><th>Currency</th><th>Voucher</th>
<th>Value in USD</th><th>Total USD</th></tr>
<tr><td>
<input name="qty1" size="3" OnBlur="CalculateTotals()" /></td>
<td>EUR</td><td>Ukash</td>
<td align="right">1.14</td>
<td><input name="total1" size="7"
OnFocus="document.orderform.qty2.select();
document.orderform.qty2.focus();" /></td></tr>
<tr><td>
<input name="qty2" size="3" OnBlur="CalculateTotals()" /></td>
<td>EUR</td><td>PaySafeCard</td>
<td align="right">1.1</td>
<td><input name="total2" size="7"
OnFocus="document.orderform.qty3.select();
document.orderform.qty3.focus();" /></td></tr>
<tr><td>
<input name="qty3" size="3" OnBlur="CalculateTotals()" /></td>
<td>USD</td><td>CashU or WMZ card</td>
<td align="right">0.90</td>
<td><input name="total3" size="7"
OnFocus="document.orderform.qty4.select();
document.orderform.qty4.focus();" /></td></tr>
<tr><td>
<input name="qty4" size="3" OnBlur="CalculateTotals()" /></td>
<td>USD</td><td>MoneyPack</td>
<td align="right">0.95</td>
<td><input name="total4" size="7"
OnFocus="document.orderform.qty1.select();
document.orderform.qty1.focus();" /></td></tr>
<tr><td></td><td></td><td></td>
<td align="right">Fee</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$2</td></tr>
<tr><td></td><td></td><td></td>
<td align="right"><b>RECEIVE THIS MANY BITCOINS:</b></td>
<td><input name="grandtotal" size="7"
OnFocus="document.orderform.qty1.select();
document.orderform.qty1.focus();" /></td></tr>
</table>
<input type="hidden" value="2" name="sh" />
</form>
<script language="JavaScript">
<!--
f=document.orderform;
f.qty1.value=0; f.qty2.value=0;
f.qty3.value=0; f.qty4.value=0;
f.total1.value=0; f.total2.value=0;
f.total3.value=0; f.total4.value=0;
f.sh.value=0;
f.grandtotal.value=0;
//-->
</script>

Basically I need to call the json feed from btcex or mtgox to convert the total USD to BTC.
advice? I can haz totals?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1481262699
Hero Member
*
Offline Offline

Posts: 1481262699

View Profile Personal Message (Offline)

Ignore
1481262699
Reply with quote  #2

1481262699
Report to moderator
asdf
Hero Member
*****
Offline Offline

Activity: 527


View Profile
April 23, 2011, 04:17:53 AM
 #2

You'll have to pull the exchange rate from the server. cross site ajax requests aren't allowed by the browser.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!