【发布时间】:2016-05-26 08:14:59
【问题描述】:
我有 Jquery 日期选择器来选择开始日期和下拉菜单来选择周数。
我正在使用以下代码来获取结束日期结果,但它不起作用:
week_number_id.on('change', function(e) {
var selectvalue = $(this).val();
//Display 'loading' status in the target select list
date_result_id.html('<i class="uk-icon-spinner uk-icon-spin"></i>');
if (selectvalue == '')
{
date_result_id.html(initial_date_result_html);
}
else
{
//Make AJAX request, using the selected value as the GET
$.ajax({
url: 'index.php',
data:'option=com_mycom&task=getmydateHTML&dvalue='+selectvalue,
success: function(output) {
date_result_id.html(output);
updateSelect(date_result_id.val());
},
error: function (xhr, ajaxOptions, thrownError) {
alert(xhr.status + ' ' + thrownError);
}
});
}
});
在php代码上:
public function getmydateHTML() {
$jinput = JFactory::getApplication()->input;
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$dt = $jinput->get ('dvalue');
$choosendate = $jinput->get ('start_date');
$newdate = strtotime("+". $dt . "week", $choosendate);
echo date('M d, Y', $newdate);
exit; // this will stop Joomla processing, and not output template modules etc.
}
结果计算日期从 1970 年 1 月 1 日开始,周数正确增加但代码无法获取开始日期
【问题讨论】:
-
持续时间是多少????
-
它基于周数。
-
这里是它的作品:https://3v4l.org/UEYRv