JSON Encoded HTML Fails
Posted: Wed Jun 08, 2011 4:50 pm
The HTML code in my array is being appended as
<a href=\"../u/ldgbug\">Sam Sangs</a> has updated her location.
When I want the actual html included on the page. Any idea how I can fix this?
I am using this to generate it...
My encoded array outputs...
<a href=\"..\/u\/somebug\">Sam Sangs<\/a> has updated her location.
And this php is what generates that array value...
<a href=\"../u/ldgbug\">Sam Sangs</a> has updated her location.
When I want the actual html included on the page. Any idea how I can fix this?
I am using this to generate it...
news_text.appendChild(document.createTextNode(feed[0]['message']));
My encoded array outputs...
<a href=\"..\/u\/somebug\">Sam Sangs<\/a> has updated her location.
And this php is what generates that array value...
$data[0][$k]['message'] = '<a href="../u/' .$r['feedusername']. '">' .ucwords($r['feedfirstname'].' '.$r['feedlastname']). '</a> has updated ' .($r['gender'] == 1 ? 'his': 'her');