当我点击一个按钮时,它应该在数据库中更新。
<c:forEach items="${listTrips}" var="trip">
<div class="col-md-12 col-xs-12 col-sm-12">
<label class="control-label">
<c:out value="${trip.tripType} @ ${trip.startTime} " />
<img src='<c:url value="/resources/images/gray_icon.png"/>' id="button" class="forImg" style="margin-left: 100px;" />
</label>
<span> <c:out value="${trip.date} @ ${trip.firstPickupPoint }" /></span>
<br>
<br>
<button type="submit" class="btn btn-success" value="${trip.trip_id}" id="button"> <i class="fa fa-check" aria-hidden="true"></i>
<i class="fa fa-taxi"></i>
</button>
<button type="button" class="btn btn-danger" value="${trip.trip_id}" onclick="notreport(this)"><i class="fa fa-times" aria-hidden="true"></i> <i class="fa fa-taxi"></i>
</button>
</div>
<hr style="border: 1px solid #a9a9a9; width: 280px;">
</c:forEach>
答案 0 :(得分:3)
$.post("Backend Function Name", Data in Json format, Call Back Function (eg :function(data, status){alert("Data: " + data + "\nStatus: " + status);});)
这是发布请求的简写