injected HTML 仅在 Dom 中解释为字符串

injected HTML Interprets as string only in Dom

我正在尝试像这样向我的 Dom 注入一个 HTML

   var oldhtmlString = // Getting html from an ajax query
  $this.parent('td').find('.newhtml').html ( oldhtmlString);

从数据库

生成HTML的服务器端代码
DataSet ds = DataAccessLayer.Instance.ExecuteThisSQLAndGetDataSet("select * from UpdateEmail");
        var table = ds.Tables[0].DefaultView.ToTable();  
        string json = Newtonsoft.Json.JsonConvert.SerializeObject(table);

我从 JSON 元素内的外部源获取了一个 HTML 字符串,我试图将它注入到我的 Dom 内的一个元素中。但它仅作为字符串注入,如下所示

        <div class="newhtml">
&lt;div style="font-size: 11px; font-family: Verdana;"&gt;&lt;p&gt;Please note that the values f::1&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;This is an automated message. Please DO NOT reply and contact the Warehouse directly for further questions.&lt;/div&gt;
 </div>

原文HTML取自数据库。看起来像这样

<div style="font-size: 11px; font-family: Verdana;"><p>Please note that the values for CO #  509226, This is an automated message. Please DO NOT reply and contact the Warehouse directly for further questions.</p></div>

当它通过 ajax 在 JSON 对象中到达客户端时,它看起来像这样

LogHTML: "<div style="font-size: 11px; font-family: Verdana;"><p>Please note that the values for ::1</td></tr></table><p>This is an automated message. Please DO NOT reply and contact the Warehouse directly for further questions.</p></div>"

谁能告诉我如何在 Dom 中正确显示此 HTML?

Note: only HTML data format is correct. I have changed data inside that HTML due to privacy reasons, so each of the above HTML code snippets would look little different.

试试这个:

        
var oldhtmlString = '&lt;div style="font-size: 11px; font-family: Verdana;"&gt;&lt;p&gt;Please note that the values f::1&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;p&gt;This is an automated message. Please DO NOT reply and contact the Warehouse directly for further questions.&lt;/div&gt;'

$('.newhtml').html( $('<div/>').html(oldhtmlString).text() );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="newhtml"> </div>