遍历每个标签的值

  html代码:

    <volist name="parArr" >{$item.name}</a>
                                     </td>

             <td>
                                           <input type="hidden" value={$item.cid} class="cid">
                                           <input type="text" style="width:50px" value="{$item.heat}">
                                      </td>
                                   </tr>
                         </tbody>
             </volist>

 

JS代码:

  <script type="text/javascript">
            // console.log(json);
            $('#add').click(function(){
                var json={};
                $('.cid').each(function(){
                    var cid=$(this).val();
                    var heat=$(this).next().val();
                    console.log(heat);
                    json[cid]=heat;
                })
                $.ajax({
                    type:"POST",
                    data:json,
                    url:"{:U('Categorys/update')}",
                    success:function(msg){
                        if(msg!='no'){
                            alert('添加成功');
                            window.location.reload();
                        }
                    }
                })
            })
        </script>

相关文章:

  • 2021-12-22
  • 2021-12-10
  • 2021-11-14
  • 2022-12-23
  • 2021-12-10
  • 2021-12-09
  • 2021-12-10
猜你喜欢
  • 2021-12-26
  • 2021-12-26
  • 2021-08-25
  • 2022-12-23
  • 2022-01-09
  • 2021-09-25
相关资源
相似解决方案