-1
我正在使用jQuery。我已經創建了一個AJAX功能如下:日期不在jQuery中傳遞函數
$.ajax({
url : '<?php echo base_url()."admin/utilities/get_project" ?>',
dataType : 'json',
success : function(responce){
var oneDay = 24*60*60*1000; // hours*minutes*seconds*milliseconds
var firstDate = new Date(responce[0].start_date);
var secondDate = new Date(responce[0].deadline);
var diffDays = Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay)));
/*=========================================*/
$(".fc-day").each(function(){
var d = $(this).data('date');
if(d >= responce[0].start_date && d < responce[0].deadline)
{
if(d == responce[0].start_date)
{
//$(this).html("<a href='#' onclick = 'init_task_modal("+responce[0].id+"); return false' class='fc-day-grid-event fc-h-event fc-event fc-start fc-end fc-resizable nisarg' style='background-color:#b72974;border-color:#b72974'><span class='fc-title'>"+responce[0].name+"</span></a>");
$(this).append("<a href='#' onclick = 'get_task_name("+responce[0].id+","+d+");' class='fc-day-grid-event fc-h-event fc-event fc-start fc-end fc-resizable nisarg' style='background-color:#b72974;border-color:#b72974'><span class='fc-title'>"+responce[0].name+"</span></a>");
}
else
{
$(this).append("<a href='#' class='fc-day-grid-event fc-h-event fc-event fc-start fc-end fc-resizable' style='background-color:#b72974;border-color:#b72974'><span class='fc-title'> </span></a>");
}
}
});
}
});
這裏,get_task_name()我已經通過了項目編號和日期。所以我創建了一個函數:
function get_task_name(project_id,tdate)
{
alert(project_id);
alert(tdate);
}
在這個函數中,我得到了項目ID,但日期不會到來。顯示爲。並且在函數中它通過爲2016-07-20。
那麼我如何才能在我的函數中獲得正確的日期值?
如果你'的console.log(d)'後,該行'變種d = $(本)。數據( '日');'這是什麼節目? – Jamiec