2014-11-23 4 views
0

내 사이트에서 기부금을받는 페이지가 있습니다. 은행의 API를 사용하려면 각 거래에 대해 고유 한 주문 ID를 생성해야합니다. 이 코드를 자바 스크립트를 사용하여 어떻게 구현할 수 있습니까?고유 제품 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);