説明
これは Ajax
を使って行うことができます。 Datepickerが閉じられたら、Ajax呼び出しを使用してセッション変数を設定できます。
ダイアログを閉じた後に変数を設定する場合は、 DatePicker
イベント onClose
を使用し、日付を選択した後に onSelect
を使用できます。私は onClose
イベントを好むでしょう。
サンプル
jQuery
$('.selector').datepicker({
onClose: function(dateText, inst) {
$.post("/backend.php", {"VariableName": dateText});
}
});
PHP (backend.php)
<?php
//set the variable
$_SESSION['VariableName'] = $_POST['VariableName'];
?>
詳しくは