springboot怎么把数据传给前端:springboot 如何引入前端 bootstrap?
这种问题网上一搜一大堆,你可以具体找一篇文章试试,遇到问题可以针对相关问题去提问。springboot通过jar包方式引入bootstrap_个人文章 - SegmentFault 思否 这不是查查就
顺晟科技
2022-10-19 14:24:55
112
我正在使用php、html、css和JavaScript创建表单。
在此表单中,用户需要选择几个关键字及其同义词。
如下所示:
<form action="create.php" class="col-md-10 offset-md-1" method="post">
<div class="form-group" id="duplicateKeyWordAndSynonym">
<label for="keyWord">Type a keyword.</label>
<textarea class="form-control" id="terms" name="terms[]"></textarea> <br/>
<label for="synonym">Type the synonyms of your keyword.</label>
<textarea class="form-control" id="synonym" name="synonym[]"></textarea> <br/>
</div>
<button class="glass-button" type="button" id="add">click here to add more keywords and
synonyms.</button>
</form>
<script>
//https://api.jquery.com/click/
$("#add").click(function () {
//https://api.jquery.com/append/
$("#duplicateKeyWordAndSynonym").append('here is the code to duplicate the keywords and
synonyms part.');
});
</script>
现在,我必须将关键字连接到“create.php”上的同义词,以便将其发送到后端。
我试过几种方法,但似乎都不起作用。
这是我第一次尝试:
<form action="create.php" class="col-md-10 offset-md-1" method="post">
<div class="form-group" id="duplicateKeyWordAndSynonym">
<label for="keyWord">Type a keyword.</label>
<textarea class="form-control" id="terms" name="terms[]"></textarea> <br/>
<label for="synonym">Type the synonyms of your keyword.</label>
<textarea class="form-control" id="synonym" name="synonym[]"></textarea> <br/>
</div>
<button class="glass-button" type="button" id="add">click here to add more keywords and
synonyms.</button>
</form>
<script>
//https://api.jquery.com/click/
$("#add").click(function () {
//https://api.jquery.com/append/
$("#duplicateKeyWordAndSynonym").append('here is the code to duplicate the keywords and
synonyms part.');
});
</script>
我尝试的最后一件事是:
<form action="create.php" class="col-md-10 offset-md-1" method="post">
<div class="form-group" id="duplicateKeyWordAndSynonym">
<label for="keyWord">Type a keyword.</label>
<textarea class="form-control" id="terms" name="terms[]"></textarea> <br/>
<label for="synonym">Type the synonyms of your keyword.</label>
<textarea class="form-control" id="synonym" name="synonym[]"></textarea> <br/>
</div>
<button class="glass-button" type="button" id="add">click here to add more keywords and
synonyms.</button>
</form>
<script>
//https://api.jquery.com/click/
$("#add").click(function () {
//https://api.jquery.com/append/
$("#duplicateKeyWordAndSynonym").append('here is the code to duplicate the keywords and
synonyms part.');
});
</script>
不起作用。我该怎么办?
============================================ 编辑:谢谢你的评论,伙计们!我是这样解决这个问题的:
<form action="create.php" class="col-md-10 offset-md-1" method="post">
<div class="form-group" id="duplicateKeyWordAndSynonym">
<label for="keyWord">Type a keyword.</label>
<textarea class="form-control" id="terms" name="terms[]"></textarea> <br/>
<label for="synonym">Type the synonyms of your keyword.</label>
<textarea class="form-control" id="synonym" name="synonym[]"></textarea> <br/>
</div>
<button class="glass-button" type="button" id="add">click here to add more keywords and
synonyms.</button>
</form>
<script>
//https://api.jquery.com/click/
$("#add").click(function () {
//https://api.jquery.com/append/
$("#duplicateKeyWordAndSynonym").append('here is the code to duplicate the keywords and
synonyms part.');
});
</script>
顺晟科技:
可以通过两种方式提交表单:
1--在javascript中,通过将脚本(document.getElementById(“myForm”).submit();其中myForm是id表单。
2--在php中,在按钮级别放置type=“submit”而不是“button”。
您可以通过$_post['terms']和$_post['synonyme']
检索页面“create.php”中的数据05
2022-12
02
2022-12
02
2022-12
29
2022-11
29
2022-11
24
2022-11