gpt4 book ai didi

javascript - 未捕获的语法错误 : Unexpected token } in javascript

转载 作者:行者123 更新时间:2023-11-30 16:59:36 26 4
gpt4 key购买 nike

我需要什么

  • 我需要从 php 文件调用 onclick 函数。

php代码

$content .= '
<div class="evt_date" >

<meta itemprop="startDate" content="'.$data[$k]['startDate'].'">
<meta itemprop="endDate" content="'.$data[$k]['endDate'].'">
<span><button type="button" class="btn btn-primary btn-listing" onClick="favaorite('.$data[$k]['id'].',"'.$data[$k]['city'].'","'.$data[$k]['country'].'","'.$data[$k]['event_url'].'")">Addtofavorite</button>
</span>

javascript代码

function favaorite(sess_id,city,country,event_url)
{
console.log(sess_id);
console.log(city);
console.log(country);
console.log(event_url);
}

最佳答案

检查这个:

$content .= '<div class="evt_date" >
<meta itemprop="startDate" content="'.$data[$k]['startDate'].'">
<meta itemprop="endDate" content="'.$data[$k]['endDate'].'">
<span><button type="button" class="btn btn-primary btn-listing" onClick="favaorite('.$data[$k]['id'].',\''.$data[$k]['city'].'\',\''.$data[$k]['country'].'\',\''.$data[$k]['event_url'].'\')">Addtofavorite</button>
</span>';

关于javascript - 未捕获的语法错误 : Unexpected token } in javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29120126/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com