Javascript 从db sql server asp net webforms绑定jquery ui日期选择器

Javascript 从db sql server asp net webforms绑定jquery ui日期选择器,javascript,jquery,asp.net,sql-server,Javascript,Jquery,Asp.net,Sql Server,我想在jquery datepicker中设置holiday,我一直在尝试这段代码 函数BindEvents(){ //日历脚本 var假日=[[2020,25,12,'圣诞节']、[2020,7,7,'周末活动']、[2020,7,13,'一些假日']、[2012,7,14,'节日']; $(函数(){ $('.datepicker').datepicker({ 日期格式:“年月日”, 展示日前:现在开始或度假 }); 函数noWeekendsOrHolidaysOrBlockedDates(

我想在jquery datepicker中设置holiday,我一直在尝试这段代码

函数BindEvents(){
//日历脚本
var假日=[[2020,25,12,'圣诞节']、[2020,7,7,'周末活动']、[2020,7,13,'一些假日']、[2012,7,14,'节日'];
$(函数(){
$('.datepicker').datepicker({
日期格式:“年月日”,
展示日前:现在开始或度假
});
函数noWeekendsOrHolidaysOrBlockedDates(日期){
//var noWeekend=jQuery.datepicker.noWeekends(日期);
返回日期:节假日(日期);
}
//设置在beforeShowDay中配置的假日功能
功能设置假日(日期){
var day=date.getDay();
如果(day==5 | | day==6)返回[false,'CalWeekEnd',];
对于(i=0;i
我使用文本框来显示jquery日期选择器

 <asp:TextBox ID="TextBox1" runat="server" CssClass="datepicker"  />
             <br />

但如果存在将数据库中的数据设置为该变量“假日”的问题,则使用日历控件而不是jquery datepicker

。然后您必须在代码端使用jqueryajax函数通过WebMethod从数据库中获取数据

 <asp:TextBox ID="TextBox1" runat="server" CssClass="datepicker"  />
             <br />
示例:如下所示。所以这个函数将从数据库中获取数据,并在success函数中显示结果。正如代码“console.log(result)”中提到的,您必须循环数据并将数据推送到数组中,以获得类似的结果

$.ajax({
                    type: "POST",
                    url: "Default.aspx/GetCustomers",
                    data: '',
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (result) {
                     console.log(result);
                     },
                    failure: function (response) {
                        alert(response.d);
                     },
                    error: function (response) {
                        alert(response.d);
                    }
                    });