Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typo3 Fluid:f:uri和Javascript变量_Typo3_Fluid_Typo3 6.2.x - Fatal编程技术网

Typo3 Fluid:f:uri和Javascript变量

Typo3 Fluid:f:uri和Javascript变量,typo3,fluid,typo3-6.2.x,Typo3,Fluid,Typo3 6.2.x,我尝试在f:uri中使用一个Javascript变量,但没有正确解析它。你能帮我建立这个字符串吗 fachid = $("#auswahlisteFaecher" ).val(); alert(fachid); var URL = "<f:uri.action action='show' arguments='{test: '"+fachid+"'}' />"; window.location.href= URL; fachid=$(“#auswahlisteFaecher”).

我尝试在f:uri中使用一个Javascript变量,但没有正确解析它。你能帮我建立这个字符串吗

fachid = $("#auswahlisteFaecher" ).val();
alert(fachid);
var URL = "<f:uri.action action='show' arguments='{test: '"+fachid+"'}' />";
window.location.href=  URL;
fachid=$(“#auswahlisteFaecher”).val();
警报(法希德);
var URL=“”;
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+"'}' />";
var URL=”“;

谢谢你的帮助

这是不可能的。当TYPO3呈现页面时,流体ViewHelper被解析,这当然是在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>

#生成指向showAction的“中立”链接
var showActionUri='';
$('body')。关于('change','auswahllisteFaecher',函数(){
var fachUid=$(“#auswahlisteFaecher”).val();
#附加应为单个视图选择的fach
var showFachUri=showActionUri+'?tx_myext_myplugin[fach]='+fachUid;
window.location.href=showFachUri
});

谢谢。但是现在我发现了这个错误,我不明白。找不到页面原因:无法验证请求参数(&cHash比较失败)