我有时会使用下面的脚本工作,但有时它会在控制台中出现Uncaught SyntaxError错误:意外的令牌<在第一行。
$products = $request->all();
foreach( $products as $product) {
$invoice->products([
'name' => $product['name'],
'price' => $product['price'],
'qty' => $product['qty'],
'total' => $product['total']
]);
}
即使在html中的inspect元素中,结果也显示
$(<?php echo '"#'.$itemid.'"'; ?>).click(function() {
$("#options").modal(options).modal('openModal');
});
没有得到这里的问题..我使用了这个脚本Script is here
答案 0 :(得分:0)
我不知道发生了什么,但你可以写一个简单的方法
$("#<?php echo $itemid; ?>")
是itemid总是一个整数?
可能更安全
$("#<?php echo intval($itemid); ?>")
在某些情况下,$ itemid为null或为空,客户端代码为
$("#")
或者像 但我认为你的问题不在这里