我突出显示了一个月中的某些日子,这取决于来自后端的数据。当我在月份或年份进行攻击时,再次打电话给阿贾克斯电话。但datepicker只显示以前的日期。我的代码如下,jquery datepicker刷新方法不起作用
$("input.dC").live('click',function() {
$(this).datepicker({
showOn:'focus',
changeMonth:'true',
changeYear:'true',
onChangeMonthYear:function(year,month,inst) {
var date = new Date(year,month-1);
obj.suggestDates(date);
$("#"+inst.id).datepicker("refresh");
},
beforeShowDay:function(date){
for(i=0;i<obj.r.length;i++) {
var m = obj.r[i];
if(date.getMonth() == m[1] && date.getDate() == m[0] && date.getFullYear() == m[2]) { return[true,"ui-state-highlight"];}
}
return[false,""];
}
}).focus();
});
obj.prototype.suggestDates=function(d){
//ajax call here
//obj.r=response;
}
仅供参考,一个副作用,这将有是,如果Ajax请求需要足够长的时间,它会引起一些浏览器的那些反应迟钝的脚本对话框之一。 – kahowell
哦好吧..谢谢@kahowell – SSS