jquery uiのdatepicker関数を無効にしようとしていますが、このコードはエラーdaySettings is undefined
を返します: http ://code.jquery.com/ui/1.9.2/jquery-ui.js 。正しいようです、わかりません...助けてください!
var $j = jQuery.noConflict();
$j(document).ready(function() {
var group_id = <? echo $bp->groups->current_group->id; ?>;
var userid = <? echo $bp->loggedin_user->id; ?>;
var myBadDates = new Array ();
function checkAvailability(mydate){
jQuery.post(
ajaxurl,
{
action : 'check_date',
verificadata: "true", userid: userid, group_id: group_id
},
function( response ) {
obj = JSON.parse(response);
var key, quanti = 0;
for(key in obj.prenotati) {
if(obj.prenotati.hasOwnProperty(key)) {
var datafrom = obj.prenotati[quanti].datafrom;
var datato = obj.prenotati[quanti].datato;
myBadDates.push(datafrom);
myBadDates.push(datato);
quanti++;
}
}
var ritorno = true;
var returnclass ="available";
checkdate = $j.datepicker.formatDate('yy-mm-dd', mydate);
for(var i = 0; i < myBadDates.length; i++) {
$j(myBadDates[i])
if(myBadDates[i] == checkdate) {
ritorno = false; returnclass="unavailable";
}
}
return [ritorno,returnclass];
}
)
}
/* $myBadDates = new array("2013-03-03","2013-03-05");
function checkAvailability(mydate){
var $return=true;
var $returnclass ="available";
$checkdate = $j.datepicker.formatDate('yy-mm-dd', mydate);
for(var i = 0; i < $myBadDates.length; i++) {
if($myBadDates[i] == $checkdate) {
$return = false; $returnclass= "unavailable";
}
}
return [$return,$returnclass];
} */
$j('#datafrom').datepicker({
dateFormat : 'yy-mm-dd',
beforeShowDay: checkAvailability,
onSelect: function(dateText, inst) {
$j("#datafrom").val(dateText);
}
});
$j('#datato').datepicker({
dateFormat : 'yy-mm-dd',
beforeShowDay: checkAvailability,
onSelect: function(dateText, inst) {
$j("#datato").val(dateText);
}
});
});