开发者

Pass codeigniter translation array to jQuery Function

开发者 https://www.devze.com 2023-01-01 00:46 出处:网络
I’ve a problem by passing an array to a jQuery function. Some code: // in the language file $lang[\'daynames\'] = array(\'So\',\'Mo\',\'Di\',\'Mi\',\'Do\',\'Fr\',\'Sa\');

I’ve a problem by passing an array to a jQuery function. Some code:

// 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){
                              }
            });
}); 

If I do lang->line(‘daynames’)); ?> in the view everything looks fine, so what is wrong here?

Thanks and b开发者_C百科est regards ...


For a start

new array

Should be

new Array

(uppercase A)

0

精彩评论

暂无评论...
验证码 换一张
取 消