Please note that I have tried the str_replace as well as the json_encode($address) but nothing has worked. Here is what I am getting back through Firebug:
That is where the problem is. If I go into the database and get rid of that one line, It solves the problem. But, I obviously have to code for the user who might input the one line in there. Even if by accident.
Try using json_encode like so:
$rows = array();
echo "{";
echo "page: $page,\n";
echo "total: $total,\n";
echo "rows: ";
foreach ($db as $row)
{
$rows[] = array(
"id"=>$row['pid']
,"cell"=> array(
'<a href="'.site_url(" class="edit" title="'.$row['name'].'"></a>'
,$row['name']
,$row['shortdesc']."\n Details"
,$row['publish']
)
);
}
echo json_encode($rows);
echo "\n";
echo "}";
As you can see i’ve purposely added \n on shortdesc, in case my values doesn’t have \n.
Please not that json_encode as well as any ajax app, requires utf-8 encoding.
