我想把 bootstrap 的form表单 中的数据转成json格式 传到后台,
用ajax方法 ,能不帮忙写下这块的js代码 或者给我点思路 谢谢
<form class="form-horizontal" role="form">
<div class="form-group">
<label for="firstname" class="col-sm-2 control-label">预警名称</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="firstname" >
</div>
<label for="lastname" class="col-sm-2 control-label">预警描述:</label>
<div class="col-sm-10">
<textarea class="form-control" rows="3" placeholder="非必填"></textarea>
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<label for="name" class="col-sm-2 control-label">预警条件:</label>
<select class="form-control" style="width: 20%;float: left;">
<option>单日交易次数</option>
<option>一周交易次数</option>
</select>
<select class="form-control" style="width: 15%;float: left;">
<option>>=</option>
<option><=</option>
<option>=</option>
<option>></option>
<option><</option>
</select>
<input type="text" class="form-control" style="width: 10%;float: left;">
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">预警方式:</label>
<div class="btn-group">
<button type="button" class="btn btn-default">短信</button>
<button type="button" class="btn btn-default">邮箱</button>
<button type="button" class="btn btn-default">短信+邮箱</button>
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">接收人:</label>
<div class="btn-group">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">请选择
<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li>
<a href="#">小明</a>
</li>
</ul>
</div>
</div>
<div class="form-inline">
<label for="lastname" class="col-sm-2 control-label">预警限制:</label>
<label class="checkbox-inline">
<input type="checkbox" id="inlineCheckbox1" value="option1">限制预警发送次数
<input type="text" class="form-control" style="width: 10%;">
次/天
</label>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">短信id:</label>
<div class="col-sm-10">
<input type="text" class="form-control" id="firstname" placeholder="">
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-2 control-label">短信模板:</label>
<div class="col-sm-10">
<textarea class="form-control" rows="5" placeholder="例:截止当前进件数为 @进件数@,累计放贷金额@放贷金额注: 请输入" @"(@前加空格)选取字段"></textarea>
</div>
</div>
</form>