朋友
我试图了解使用Sring MVC表单和AJAX
发布数据的最佳方法在我的代码中
<form:form modelAttribute="ConfigForm" accept-charset="UTF-8" action="/channelConfig/voice/save" cssClass="form-horizontal" method="post">
<div style="text-align: left;" class="span3 row-fluid">
<label><spring:message code="alert.channels.outbound.lines"></spring:message>: </label>
</div>
<div class = "span3">
<div class="input-mini">
<div class="textVal">${alertStatusForm.outboundLines}</div>
<div class="pencil span3 ">
<i class="icon-edit icon-large"></i>
</div>
<div class="save span3" onclick="submitForm()">
<i class= "icon-save icon-large "></i>
</div>
<div class="close span3">
<i class= "icon-remove"></i>
</div>
</div>
</div>
</form:form>
现在我的submitForm()代码是
function submitForm() {
jQuery.ajax("/monitor/status/save/event/${alertStatusForm.outboundLines}" ,
{
type:"POST"
});
}
如果上述方式更好或建议使用合适的方法发布数据,请告诉我