【问题标题】:Generate unique product id [duplicate]生成唯一的产品 ID [重复]
【发布时间】:2015-01-21 03:40:12
【问题描述】:

我的网站上有一个用于接收捐款的页面。我的银行 API 要求我为每笔交易生成一个唯一的订单 ID。如何使用 javascript 在我的代码中实现这一点?

我使用的代码如下所示。

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('xxx@xxx.org');
</script>

【问题讨论】:

    标签: javascript html uuid


    【解决方案1】:
    Math.random().toString(36).substring(7);
    

    【讨论】:

      猜你喜欢
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      • 2015-02-23
      • 2011-05-08
      • 2018-07-27
      • 2016-04-13
      • 1970-01-01
      • 2012-02-22
      相关资源
      最近更新 更多