Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/453.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
Javascript 下划线模板问题-未捕获语法错误:意外标记<;_Javascript_Underscore.js - Fatal编程技术网

Javascript 下划线模板问题-未捕获语法错误:意外标记<;

Javascript 下划线模板问题-未捕获语法错误:意外标记<;,javascript,underscore.js,Javascript,Underscore.js,当我尝试加载一个下划线模板时,出现上述错误。我猜它是for循环中的某种问题(可能是一个-,但我还不太了解它们的结构) 我的模板 <script type="text/html" id="Customer-List-View"> <p> Please click on a customer to select </p> <table > <thead>

当我尝试加载一个下划线模板时,出现上述错误。我猜它是for循环中的某种问题(可能是一个-,但我还不太了解它们的结构)

我的模板

    <script type="text/html" id="Customer-List-View">
    <p> Please click on a customer to select </p>
        <table >
            <thead>
                <th> Customer Name </th><th>Last Invoice date</th><th>Last item added</th>
            </thead>

            <tbody>
                <% for (var i = 0, i < customers.length, i++){ %>
                    <tr class="cusTableRow"  id="<%=customers[i].objectId %>" >
                        <td> <%= customers[i].custName %> </td>
                        <td> <%= customers[i].custLastInvoiceDate %> </td>
                        <td> <%= customers[i].CustLastItemDate %> </td>
                    </tr>

                <% }; %>
            </tbody>
        </table>
        <button id="customerAdd"> Add a new customer </button>

    <p> here should be a set of buttons for working with customers </p>

</script>
我相信这很简单,但这是我在模板中的第一个表,我看不出问题所在


收到的任何帮助

您在的
中使用逗号而不是分号

<% for (var i = 0, i < customers.length, i++){ %>

应该是

<% for (var i = 0; i < customers.length; i++){ %>

或者您可以使用u.each()代替标题。我查看了每个标题,但不确定上下文设置。我计划在这一页开始工作后再看一遍。谢谢你的建议
<% for (var i = 0; i < customers.length; i++){ %>