执行以下操作时,我收到错误消息'undefined method`gsub'for 2014-10-31 17:55:55 +0530:Time'
代码是
$(文件)。就绪(函数(){
jQuery(“。countdown_timer_widget”)。countdowntimer(“<%= j(Time.now)%>”,“<%= j(@end_time)%>”);
});
我不知道如何纠正它,帮助我
答案 0 :(得分:1)
试试这个:
$(document).ready(function(){ jQuery(".countdown_timer_widget").countdowntimer("<%= j (Time.now.to_s) %>", "<%= j (@end_time.to_s) %>");
});
答案 1 :(得分:0)
尝试:
$(document).ready(function(){ jQuery(".countdown_timer_widget").countdowntimer("<%= j (Time.now.to_s) %>", "<%= j (@end_time) %>");
});
方法gsub用于字符串,因此您必须将Date转换为字符串。