0
我有這種模式,它將orderID
設置爲模式。在這種模式下,它有一個<form></form>
做另一個請求和一個<a>
標籤做另一個請求。我的問題是,價值來自JavaScript函數,我不能使用<a href="ApproveSurgery?orderid15=<%=orderID%>"></a>
那麼,我該如何將值傳遞給Servlet?或者還有其他更簡單的方法嗎?我試着這樣做使用<a>標記或其他方式將值從JavaScript傳遞到Servlet
HTML:
<div aria-hidden="true" aria-labelledby="myModalLabel" role="dialog" tabindex="-1" id="myModal15" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<form action="LabRequest2" method="POST"> //Form that is doing other request
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">
<a name="doctororder15" id="doctororder15" style="color: white;"></a>
</h4>
</div>
<div class="modal-body">
<input type="hidden" name="orderid15" id="orderid15">
<input type="hidden" name="remarks15" id="remarks15">
// this is the a tag that is doing another request aside from the form
Continue/Approve Surgery? <a href="ApproveSurgery?orderid151515">Yes</a>
</div>
<div class="modal-footer">
<button data-dismiss="modal" class="btn btn-default" type="button">Back</button>
<button class="btn btn-theme" type="submit">Send Request</button>
</div>
</form>
</div>
</div>
</div>
的JavaScript:
function setOrder15(orderID) {
for(var i = 0; i < orderids.length; i++) {
if(parseInt(orderids[i]) === orderID) {
$(".modal-body #orderid15").val(orderids[i]);
document.getElementsByName("orderid151515")[0].innerHTML = orderids[i];
}
}
}
最好有'返回goToNewPage()'並在onclick中返回false。 – mplungjan