我注意到某些名称条目,如 O'Rourke 或 O'reilly 在某些情况下会破坏 javascript。我想知道你是怎么处理的。我从 PHP/MYSQL 中提取这些名称并将它们放入 javascript 中。
您是在进入数据库之前还是在退出数据库之后替换它们?
提前致谢
google.load('visualization', '1', {packages:['table']});
google.setOnLoadCallback(drawTable);
function drawTable() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'First Name');
data.addColumn('string', 'Last Name');
data.addColumn('string', 'email');
data.addColumn('string', 'Parent email 1');
data.addColumn('string', 'Parent email 2');
data.addColumn('string', 'Advisor');
data.addColumn('string', 'Active');
data.addColumn('string', 'Edit');
//data.addColumn('number', '');
data.addRows([
<?php
if(count($items))
{
foreach($items as $item)
{
foreach($advisors as $key=>$advisor)
{
if($item['advisor']==$advisor['id'])
{
$ad=$advisor['last_name'];
}
}
$active_icon = ($item['active']=='1'?'tick':'cross');
$editlink = anchor('auth/admin/members/form/'.$item['id'],$this->bep_assets->icon('pencil'));
echo "['".$item['first_name']."', '".$item['last_name']."', '".$item['email']
."', '".$item['parent_email1']."', '".$item['parent_email2']."', '".$ad."', '".$this->bep_assets->icon($active_icon)."','".$editlink."'],";
}
}
?>
]);
var table = new google.visualization.Table(document.getElementById('table_div'));
table.draw(data, {showRowNumber: true, allowHtml:true});
}