Skip to content

Instantly share code, notes, and snippets.

@ayuLiao
Created July 3, 2018 04:13
Show Gist options
  • Save ayuLiao/5f15cf66851aabcbe6142be7e513a2dd to your computer and use it in GitHub Desktop.
Save ayuLiao/5f15cf66851aabcbe6142be7e513a2dd to your computer and use it in GitHub Desktop.
form表单提交,通过jquery简单实现
<form class='form-horizontal group-border-dashed' action="{{info['subUrl']}}" method='POST' id='broadcastForm' onSubmit='return false'>
<div class="form-group">
<label class="col-sm-3 control-label">人数</label>
<small>满多少人送红包</small>
<div class="col-sm-6">
<input style="width:100%;float:left;" class="form-control" type="text" name="peoplenum" id="peoplenum" >
<label class="hitLabel" for="peoplenum">*</label>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">红包总金额</label>
<small>满多少人送多少金额的红包</small>
<div class="col-sm-6">
<input style="width:100%;float:left;"class="form-control" type="text" name="hongbaonum" id="hongbaonum" >
<label class="hitLabel" for="hongbaonum">*</label>
</div>
</div>
<div class="modal-footer" style="text-align:center">
<button type="submit" class="btn btn-primary">保存更改</button>
</div>
</form>
</div>
</div>
<script>
// 点击按钮,提交表单
$('#broadcastForm').submit(function(){
formAjax($(this).attr("action"), $(this).attr("method"), $(this).serialize(),'正在保存...');
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment