2014-11-23 80 views
0

我有一個網頁,我在我的網站上收到捐款。我的銀行的API要求我爲每筆交易生成唯一的訂單ID。我怎樣才能在我的代碼中使用JavaScript來實現這一點?生成唯一的產品ID

我使用的代碼如下所示。

Please enter the amount you wish to donate and click on the pay button. Thank you 

<form id="&quot;form1」"> 
    <div> 

    Amount:<input id="txtAmt" type="text" /> 

    </div> 
</form> 
<script src="https://cipg.diamondbank.com/cipg/MerchantServices/UPaybutton.ashx?mercId=xxxxx&amp;CurrencyCode=566" type="text/javascript"> 
</script> 
<script type="text/javascript"> 
    upay_settings.setAmountField('txtAmt'); 
    upay_settings.setOrderId('31-Augdd-2014'); // This is the id I'd want to randomize 
    upay_settings.setProduct('Donation'); 
    upay_settings.setEmail('[email protected]'); 
</script> 

回答

1
Math.random().toString(36).substring(7);