简体   繁体   English

在开发人员工具上获取语法错误

[英]Getting syntax error on developer tools

I'm getting an unexpected syntax error: unexpected token [ 我收到了意外的语法错误:意外的标记[

Here is my code. 这是我的代码。

$ajaxString = "";
foreach ($z as $key => $val) {
    $ajaxString .= "image[]=$val&";
}
$ajaxString = substr($ajaxString,0,-1);

$DATA .= "
    <div class='order-item-info'>
        <div class='order-item-download-all'>
            <input type='image' src='images/download-all.png' alt='Submit' onclick='download(".$ajaxString.")'>
        </div>
    </div>\n";

My code on the developer tools looks like this. 我在开发人员工具上的代码如下所示。

<input type='image' src='download-all.png' alt='Submit' onclick='download(image[]=Logo.jpg&image[]=Logo_Large.jpg&image[]=)'>

I know I'm missing something, just can't put my finger on it. 我知道我缺少了一些东西,只是无法将手指放在上面。

The parameter to the download function should be a string. download功能的参数应为字符串。 As it is, it is not. 实际上,事实并非如此。 Change the code: (snippet) 更改代码:(代码段)

<input type='image' src='images/download-all.png' alt='Submit' onclick='download(\"".$ajaxString."\")'>

so that it produces the following 这样就产生了以下

<input type='image' src='download-all.png' alt='Submit' onclick='download("image[]=Logo.jpg&image[]=Logo_Large.jpg&image[]=")'>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM