将codeigniter转换数组传递给jQuery函数

时间:2010-05-27 08:19:33

标签: jquery codeigniter

通过将数组传递给jQuery函数我遇到了问题。一些代码:

// in the language file
$lang['daynames'] = array('So','Mo','Di','Mi','Do','Fr','Sa');

//In the view
<script type="text/javascript" charset="utf-8">
    var config     = { basePath : '<?php echo $base; ?>' }; // THIS WORKS GREAT!!!
    var days       = new array('<?php echo implode("','",$this->lang->line('daynames')); ?>');
</script>

//in the js-File
    $(function() {
            $("#datepicker").datepicker({
                dateFormat  : 'dd.mm.yy',
                showWeek    : true,
                firstDay    : 1,
                weekHeader  : 'KW',
                dayNamesMin : days,
                monthNames  : ['Januar','Februar','März','April',
                               'Mai','Juni','Juli','August','September',
                               'Oktober','November','Dezember'],
                onSelect    : function(dateText,inst){
                              }
            });
}); 

如果我做lang-&gt; line('daynames')); ?&GT;在视图中一切都很好,所以这里有什么问题?

谢谢和最诚挚的问候......

1 个答案:

答案 0 :(得分:2)

首发

new array

应该是

new Array

(大写A)