serialize()

序列表表格内容为字符串,用于 Ajax 请求。



例如:

<form action="../../deviceApply/updateApplyStatus.action" role="form" id="applyForm" method="post">
  <input type="hidden" value="${ apply.pk}"   name="apply.pk">
</form>





$.get("../../deviceApply/updateApplyStatus.action?"+$("#applyForm").serialize(),function(res){
if(res.message==1){
alert("审批成功!");
tableUtils.queryTable();
$('#ajax-moda').modal('hide'); 
}
});



例如2:


<p id="results"><b>Results: </b> </p>
<form>
  <select name="single">
    <option>Single</option>
    <option>Single2</option>
  </select>
  <select name="multiple" multiple="multiple">
    <option selected="selected">Multiple</option>
    <option>Multiple2</option>
    <option selected="selected">Multiple3</option>
  </select><br/>
  <input type="checkbox" name="check" value="check1"/> check1
  <input type="checkbox" name="check" value="check2" checked="checked"/> check2
  <input type="radio" name="radio" value="radio1" checked="checked"/> radio1
  <input type="radio" name="radio" value="radio2"/> radio2
</form>




$("#results").append( "<tt>" + $("form").serialize() + "</tt>" );



Results: single=Single&multiple=Multiple&multiple=Multiple3&check=check2&radio=radio1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值