Search code examples
javascriptjqueryexpressionengine

Rendering ExpressionEngine Tags in Javascript?


After much digging and searching about I haven't found a solution that allows for EE bracket tags to correctly render within javascript. It just renders the EE tag as text and not the actual code within the global snippet.

$config['remove_unparsed_vars'] = 'y';
var $containerHeight = $('.section-content').height();   
var widget = ('{list}'); 
if ( $containerHeight > 1500  ) {
    $('.widget-box').append(widget);
}

Any thoughts or feedback will be much appreciated.


Solution

  • A quick google found

    $conf[‘protect_javascript’] = ‘n’;

    and

    ExpressionEngine rendering JS code with { } brackets