功能如下:
点击购买后,点击确定。
确定调用了一个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>
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://it1995.blog.csdn.net/article/details/123392292
内容来源于网络,如有侵权,请联系作者删除!