ajax post 与get方法 data写法
发布时间:2020-12-15 20:57:52 所属栏目:百科 来源:网络整理
导读:div class="panel_block" !--div class="padding"a href="?=BASE?store/export/" class="btn btn-primary" 导出/a/div-- div class ="padding"a href="?=BASE?store/addorder/" class="btn btn-primary"添加/a/div table class="table table-striped" id="jt
<div class="panel_block" > <!--<div class="padding"><a href="<?=BASE?>store/export/" class="btn btn-primary" >导出</a></div>--> <div class ="padding"><a href="<?=BASE?>store/addorder/" class="btn btn-primary">添加</a></div> <table class="table table-striped" id="jtable" > <?if(is_array($param)){?> <thead> <tr> <th>款号</th> <th>颜色</th> <th>尺码</th> <th>操作数量</th> <th>旺旺</th> <th>操作者</th> <th>操作时间</th> <th>是否有货</th> <th>是否发货</th> <th>备注</th> <th width="80" > 操作 </th> </tr> </thead> <?foreach ($param as $r ){ ?> <tbody><tr> <td><?=$r['order_id']?></td> <td><?=$r['color']?></td> <td><?=$r['p_size']?></td> <td><?=$r['num']?> <?=$r['unit']?></td> <td><?=$r['wangwang']?></td> <td><?=$r['doer']?></td> <td><?=date('m-d H:i',$r['datetime'])?></td> <td><?if ($r['havegoods']==1) {?><img alt="有货" id="c_status" onclick="hiden($(this),<?=$r['order_id']?>,0);" src="/static/img/gou.png" width="20" height="20" align="absmiddle" /> <? }else{ ?> <img alt="无货" id="c_status" onclick="hiden($(this),1);" src="/static/img/cha.png" width="20" height="20"align="absmiddle"/><? } ?></td> <td><?=$r['delivergoods']?></td> <td><?=$r['remark']?></td> <td> <a href="<?=BASE?>store/edit/<?=$r['order_id']?>" >编辑</a> </td> </tr> <? } }?></tbody> </table> <?=$pagination?> </div> </div> <script> function hiden(obj,order_id,havegoods){ //alert(obj.attr("src")); $.ajax({ type:'post', url:'/?/store/status/', data:{order_id:order_id,havegoods:havegoods}, success:function(result){ if(result==1){ obj.attr("src",'/static/img/gou.png'); obj.attr("onclick","hiden($(this),"+order_id+",0);"); }else{ obj.attr("src",'/static/img/cha.png'); obj.attr("onclick",1);"); } } }); } </script> <script type="text/javascript" src="static/js/jquery.dataTables.min.js"></script> <script> $(document).ready(function() { $('#jtable').dataTable({"bPaginate": false, "oLanguage": { "sLengthMenu": "显示 _MENU_ 条每页", "sZeroRecords": "什么都没有找到 - 很抱歉", "sInfo": "总共 _TOTAL_,显示 _START_ 至 _END_ 条", "sSearch": "搜索", "sInfoEmpty": "没有数据!", "sInfoFiltered": "(过滤自 _MAX_ 条数据)" } }); } ); </script> ajax post 与get方法 data写法一样,利用firebug调试的时候,程序里面用echo打印会在下图显示: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |