Bitcoin Forum
May 10, 2024, 10:14:44 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: JSON/webform nub question (exchanging psc to btc)  (Read 1071 times)
frontlineassembly (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


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?
1715336084
Hero Member
*
Offline Offline

Posts: 1715336084

View Profile Personal Message (Offline)

Ignore
1715336084
Reply with quote  #2

1715336084
Report to moderator
1715336084
Hero Member
*
Offline Offline

Posts: 1715336084

View Profile Personal Message (Offline)

Ignore
1715336084
Reply with quote  #2

1715336084
Report to moderator
Make sure you back up your wallet regularly! Unlike a bank account, nobody can help you if you lose access to your BTC.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715336084
Hero Member
*
Offline Offline

Posts: 1715336084

View Profile Personal Message (Offline)

Ignore
1715336084
Reply with quote  #2

1715336084
Report to moderator
1715336084
Hero Member
*
Offline Offline

Posts: 1715336084

View Profile Personal Message (Offline)

Ignore
1715336084
Reply with quote  #2

1715336084
Report to moderator
1715336084
Hero Member
*
Offline Offline

Posts: 1715336084

View Profile Personal Message (Offline)

Ignore
1715336084
Reply with quote  #2

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

Activity: 527
Merit: 500


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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!