springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-18 13:57:07
57
我试图在我的代码中包含一个确认对话框,但我在实现它时卡住了。我想添加一个按钮到我的代码,通过点击它,我得到一个确认对话框。按下";是-选项";它应该删除我的数据库中的数据,同时按下";无选项";应关闭对话框,不执行任何其他操作。但实际上,当我运行代码时,我得到了对话框和确认“是/否”选项,但运行“否”选项HTML中的提交代码也会触发,因此通过选择“是”或";否";我得到了同样的效果,它总是从我的数据库中删除数据。
这是我的HTML代码:
<form method="POST" action="/delete/prop" >
<p class="card-text h6"> <b>Typology: </b> <%= book.typology %> </p>
<input type="hidden" name="id5" value=<%= book.id %> />
<input type="hidden" name="prop" value= "typology" />
<input type="submit" value="Yes" class="button btn btn-danger" onclick="confirmAction()" />
</form>
我的JavaScript与对话代码有关:
<代码><;脚本类型=";文本/JavaScript";>;函数confirmAction(){let confirmAction=confirm(";您确定要执行此操作吗?";);if(确认操作==true){警报(";操作成功执行";);}否则{警报(";操作已取消";);}}
顺晟科技:
我在@anavega发布的另一个网站上找到了解决方案。
她提到我漏掉了HTML中的<script type="text/javascript">
function confirmAction() {
let confirmAction = confirm("Are you sure to execute this action?");
if (confirmAction == true) {
alert("Action successfully executed");
} else {
alert("Action cancelled");
}
}
元素。
这里有一个例子来测试它:
return
<代码><;input type=“ submit ” value=“ yes ” Class=“ button btn btn-danger ” onclick=“ return confirmaction()”/>;
谢谢你的帮助!
05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11