TypeError:g [b]未定义

时间:2018-09-01 12:02:41

标签: javascript jquery asp.net-mvc datetimepicker

我试图将编码值传递给datetimepicker,以便使用“ daysOfTheWeekDisabled”禁用特定的日期。问题是我收到TypeError:检查控制台时,g [b]未定义为错误。可能是什么问题?

代码如下:

    <script type="text/javascript">
    $(document).ready(function () {
        $('#VehicleIDDD').change(function () {
            var vehdrv = ($('#VehicleIDDD :selected').val());                              
            var val = vehdrv.split("_");
            var drvid = val[1];
            var vehid = val[0];

            if (drvid == "0") {              
                $("#DriverID > option").each(function () {
                    $(this).show();
                });
            }
            else {
                //console.log(vehid + "= with driver " + drvid);
                $("#DriverID > option").each(function () {
                    var option_val = $(this).val();
                    if (option_val != drvid) {
                        $(this).hide();
                    }                       
                });
            }
            $("#DriverID").val(drvid)
            $("#VehicleID").val(vehid);


            $.ajax({
                type: 'GET',
                url: '@Url.Action("checkCodingDay", "Reservation")',
                data: { "VehicleID": vehid },
                dataType: 'json',
                success: function (data) {
                    var coding = data[0].CodingDay
                    daysOfWeekDisabled(coding);                   
                },
                error: function (emp) {
                    alert('error');
                }
            });

        }).trigger("change");
    })

    function daysOfWeekDisabled(coding) {
        $("#datetimepicker").datetimepicker({
          daysOfWeekDisabled: coding,                         
        });
        $("#datetimepicker").datetimepicker('refresh');       

    }

</script>

如果您需要更多详细信息,请注释掉,我会添加您要查找的内容。

更新 TypeError: g[b]

coding value

coding value 2

0 个答案:

没有答案