Uncaught SyntaxError: Unexpected token } in jQuery
This is my php code
$p1 = explode(',',$pprod_material->p1);
$p11 = json_encode($p1);
This is my Html code
<input style="margin-left:-10px;" type="checkbox" onClick="qst_check_ingri(<?php echo $p11; ?>);" id="<?php echo $id44; ?>" value="<?= $id44; ?>" name="extra_check" >
This is my click function in script
function qst_check_ingri (val)
{
alert(JSON.stringify(val));
}
This is my view-source code output
<input style="margin-left:-10px;" class="badgebox" type="checkbox" onclick="qst_check_ingri('[" 1","4","7","10","13","16","18","21","24","27","30","33","36",""]');"="" id="4-e1" value="4-e1" name="extra_check">
I don't why I'm getting this error from my view code is fine still it shows
Uncaught SyntaxError: Unexpected token }
在单引号中传递你的php值
onClick="qst_check_ingri('<?php echo $p11; ?>');"
链接地址: http://www.djcxy.com/p/8034.html
上一篇: 未捕获的语法错误意外的令牌}