📌  相关文章
📜  jquery 获取选中的复选框项目并传递给 C# MVC 消费的参数 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:35.755000             🧑  作者: Mango

代码示例1
var checkItems = $('[name="checkbox"]:checked');
            var combines = [];
            $.each(checkItems, function (i, arqs) {
                combines.push($(this).attr('data-combine'));
           });
            var param = {
                'cmbinedata': combines
            }
          
              $.ajax({
                url: '@Url.Action("YourMethodName", "YourCOntrollerName")',
                data: JSON.stringify(param),
                type: "POST",
                dataType: "json",
                contentType: 'application/json; charset=utf-8',
                success: function (result) {
                      //do something
                },
                error: function (err) {
                    tata.error('Error', "Error !!!");
                    location.reload();
                }
            });