使用smarty模板时如何在脚本中获取值?

时间:2018-07-10 07:54:04

标签: javascript php smarty

我有一个模板,其中包含一个用于模板选择操作的脚本:

<div class="col-sm-4">

    <label for="inputPriority">{$LANG.products_nav_label}</label>
    <select name="product_sel" id="product_sel" class="form-control">
        <option value="default_service"{if $product_sel eq "default_service"} selected="selected"{/if}>
            {$LANG.products_nav.default_service}
        </option>
        <option value="qicloud_dedicate_server"{if $product_sel eq "qicloud_dedicate_server.tpl"} selected="selected"{/if}>
            {$LANG.products_nav.qicloud_dedicate_server}
        </option>
    </select>
</div>

<br />
<br />
<br />

{if xxx } {* how can I get the current selected product value? *}
  {include xxx}
{/if}

<script type="text/JavaScript" src='{$_SERVER['DOCUMENT_ROOT']}/templates/clientareaproducts_ext/js/clientareaproducts.js'>
</script>

clientareaproducts.js代码是:

$("#product_sel").change(function(){
    var product_sel_value=$("#product_sel").val();
});

如何在我的{if xxx }语句中获取脚本的product_sel_value

0 个答案:

没有答案