单选多选post值到控制器处理
更新:HHH   时间:2023-1-7


<td>
  <label class="checkbox">
          <input type="hidden" name="orderBy" value="<?=$val['orderBy']?>" >
     <input class="check" name="houseIds[]" type="checkbox" value="<?=$val['parmaId']?>">
  </label>
</td>
$("#configplshenhe").bind("click",function(){
    var arr = [];
    var csrfToken = $('meta[name="csrf-token"]').attr("content");
    var arrvalue1=[];
    $("[name='feedIds[]'].check").each(function(){

        if(this.checked){
            arr.push($(this).val());
            var tr=$(this).parents('tr');
            var arrvalue=tr.find("#orderBy").val();
            arrvalue1.push(arrvalue);
            // console.log(arrvalue);


        }

    });
    if(arr.length == 0){
        layer.msg("逗我呢?您选中数据了?!");

        return false;

    }
    console.log(arr);console.log(arrvalue1);
    layer.confirm('你确定你要更新这些选中的数据?', function(index){

        $.ajax({
            url: confighandle,
            type: 'post',
            data: {autoId: arr , orderBy:arrvalue1},

            success: function (data) {
                console.log(data);
                if(data==1){
                    window.location.href=window.location.href;
                    layer.msg("操作成功");
                }else if(data==3) {
                    layer.msg("数据重复");
                }else {
                    layer.msg("操作失败");
                }
            }
        });
        //$('[name="delEsf"]').val(arr.join(","));alert("0o

        ;        // searchForm.submit();

    });

    //return false;

});
返回开发技术教程...