safesite/safesite/templates/companyinfo.html

50 lines
1.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<form method="post" action="/companyinfo/" id="companyform">
{% csrf_token %}
{{ companyinfo.non_field_errors }}
<table class="detailtable" style="margin:10px">
<thead>
<tr>
<th style="width:50%">
属性
</th>
<th style="width:50%">
内容
</th>
</tr>
</thead>
<tbody>
{% for field in companyinfo %}
<tr>
<td> {{ field.label_tag }}</td>
<td>{{ field }}{{ field.errors }}</td>
</tr>
{% endfor %}
<tr>
<td colspan="2"><button type="button" class="btn btn-primary float-right" onclick="submitForm()">提交</button></td>
</tr>
</tbody>
</table>
</form>
<script>
function submitForm() {
// jquery 表单提交
$("#companyform").ajaxSubmit(function(result) {
// 对于表单提交成功后处理result为表单正常提交后返回的内容
if (result.code == 1) {
$.messager.show({
msg:'保存成功',
timeout:1000,
showType:'slide'
});
}else{
$.messager.show({
msg:'保存失败',
timeout:1000,
showType:'slide'
});
}
});
return false; // 必须返回false否则表单会自己再做一次提交操作并且页面跳转
}</script>