returning html tags from ajax request c#
<p>I am able to display HTML elements when retrieving data from a database. When retrieving data via an ajax request however, it seems the HTML elements are ignored. I'd like to retrieve HTML elements using the ajax request. Any help here would be appreciated.</p>

<pre><code>private class loadvals
{
    public string html { get; set; }
}


[System.Web.Services.WebMethod]
public static string GetHtml(int id)
{
    connection conn = new connection();

    string query = "Select html from table where id = '1'";

    using (SqlConnection con = new SqlConnection(conn.GetConnectionString()))
    {
        using (SqlCommand cmd = new SqlCommand(query))
        {
            List&lt;loadvals&gt; cus = new List&lt;loadvals&gt;();
            loadvals row;
            cmd.CommandType = CommandType.Text;
            cmd.Connection = con;
            con.Open();
            using (SqlDataReader sdr = cmd.ExecuteReader())
            {
                while (sdr.Read())
                {
                    row = new loadvals();
                    row.post = System.Web.HttpUtility.HtmlEncode(sdr["html"].ToString());
                    cus.Add(row);
                }
            }
            con.Close();
            var ser = new JavaScriptSerializer();
            var serialized = ser.Serialize(cus);
            return serialized;
        }
    }
} 



function javascriptFunction(test) {

$.ajax({
    type: "POST",
    async: false,
    url: "/html.aspx/GetHtml",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    success: function (r) {
        var parsed = JSON.parse(r.d);
        for (var i = 0; i &lt; parsed.length; i++) {
            alert(parsed[i]["html"]);
        }
    },
    error: function (XMLHttpRequest, textStatus, errorThrown) {
        alert(XMLHttpRequest + " " + textStatus + " " + errorThrown);
    }
});
return false;
}
</code></pre>

<p>Thanks.</p>