功能如下:
点击购买后,点击确定。
确定调用了一个js函数,提交form表达给后端
代码如下:
- <div class="modal-footer">
- <button type="button" class="btn text-white border bg-dark" data-bs-dismiss="modal">取消</button>
- <button type="button" class="btn text-white border bg-dark" onclick="purchaseProduction()">确定</button>
- </div>
对应的js代码如下:
- <script>
- function purchaseProduction(){
-
- var fundId = document.getElementById("fundId").value;
- var purchaseMoney = document.getElementById("purchaseMoney").value;
-
- var params = {
- fundId: fundId,
- purchaseMoney: purchaseMoney
- }
- var temp = document.createElement("form");
- temp.action = "index.php?p=user&c=fund&a=confirmPurchase";
- temp.method = "post";
- temp.style.display = "none";
- for (var x in params) {
- var opt = document.createElement("input");
- opt.name = x;
- opt.value = params[x];
- temp.appendChild(opt);
- }
- document.body.appendChild(temp);
- temp.submit();
- }
- </script>