我有一个由perl模块生成的perl中未知大小的数组。现在,我正好想要查找在perl数组中是否存在传递给jquery函数的值。在JavaScript中访问Perl数组
有没有办法我可以做一个元素按元素比较输入值与perl数组中的每个值?
我环顾四周,看起来像我可以通过提供索引来访问jQuery中的perl数组,但我们不知道数组的大小。所以我不知道什么时候停止。
我的水泥工代码看起来类似于:
<%perl>
my @testArray = [call to some other perl module to get the values]
</%perl>
<script type="text/javascript">
function checkIfValExistsInTestArray(val) {
// Code to test if "val" exists in "@testArray". Returns boolean true/false.
}
</script>
你可以与我们分享你的尝试吗? –
,因为它们都运行在不同的环境中,并且在不同的时间需要更加具体。 – charlietfl
@charlietfl我编辑了语句并添加了示例场景,代码如何。我对这项技术相当陌生,因此一半熟知查询。 – rajneesh2k10