我尝试在f:uri中使用Javascript变量,但未正确解析。你能帮助构建String吗?
fachid = $("#auswahlisteFaecher" ).val();
alert(fachid);
var URL = "<f:uri.action action='show' arguments='{test: '"+fachid+"'}' />";
window.location.href= URL;
我也尝试过CDATA
"<f:uri.action action='show' arguments='{test: <![CDATA[fachid}]]>' />";
HTML输出:
var URL = "<f:uri.action action='show' arguments='{test: '"+fachid+"'}' />";
感谢您的帮助!
答案 0 :(得分:0)
这是不可能的。 TYPO3呈现页面时会解析Fluid ViewHelpers,这当然是在JavaScript发挥作用之前。
您可以执行以下操作:
<script>
# Generate a "neutral" link to the showAction
var showActionUri = '<f:uri.action action="show" noCacheHash="true" />';
$('body').on('change', '#auswahllisteFaecher', function() {
var fachUid = $("#auswahlisteFaecher" ).val();
# Attach the fach that should be selected for the single view
var showFachUri = showActionUri + '?tx_myext_myplugin[fach]=' + fachUid;
window.location.href = showFachUri
});
</script>