这是我的html
null
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"></script>
<div class="input-group mb-3">
<div class="input-group-prepend">
<label class="input-group-text" for="stores">select</label>
</div>
<select class="custom-select" id="stores">
<option selected>choose...</option>
<option value="1">Option 1 </option>
<option value="2">Option 2</option>
</select>
null
我的问题是热发出ajax请求,并将选定的选项发送到后端并返回结果?
制作了一个简单的解决方案
我在表单标记中添加了select,并使用了以下脚本selectedonchange='this.form.submit()'
如果有人有更好和更好的解决方案,请分享。