i can't have a datepicker work inside tab loaded via ajax. here the script on my main page:
<head>
<meta http-equiv="Content-type" content="text/html; charset=ISO-8859-1" />
<title>Studio90DMS - Ricerca Generale</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="../lib/datepicker-it.js"></script>
<script type="text/javascript" src="../lib/rollover.js"></script>
<link rel="stylesheet" type="text/css" media="screen" href="../css/screen.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../css/jqueryobject.css" />
</head>
<script>
$(document).ready(function() {
$( "#tabs" ).tabs({
});
});
</script>
on the tab i need the datepicker i have the following:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script>
<script src="../lib/datepicker-it.js"></script>
<script>
$(document).ready(function() {
$.datepicker.setDefaults( $.datepicker.regional[ "it" ] );
$( ".datepicker" ).datepicker({
changeMonth: true,
changeYear: true,
dateFormat: "dd/mm/yy",
beforeShowDay: highlightOddsEven,
showOtherMonths: true,
selectOtherMonths: true
});
});
function highlightOddsEven(date) {
//return [true, date.getDate() % 2 == 1 ? 'odd' : ''];
return [true, date.getDate() % 2 == 1 ? 'oddEven' : 'oddEven'];
}
$('#form_termine').on('submit', function(e){
e.preventDefault();
var formSrc = $(this).attr('action');
var formMethod = $(this).attr('method');
var formData = $(this).serialize();
$.ajax({
url: formSrc,
type: formMethod,
data: formData,
success: function(data){
//work with returned data from requested file
$("#termConsegna").html(data);
}
});
});
</script>
when i switch on the tab i get the following errors and the datepicker does not work:
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
VM551:15 Uncaught TypeError: Cannot read property 'regional' of undefined
VM552:2 Uncaught TypeError: Cannot read property 'setDefaults' of undefined
can anyone help me?