Json returned my HTML <br/ "> in the form unicode \ u003cbr / \ u003e. Causing <br/"> printed as text, not creating a new line
I am using ASP.net MVC3 and I have returned the model which is in Json format using Jquery.AJAX and then pass it to the jQuery template for printing. A.
For example, Json, which returned the server,
{"Key":2,"Content":"I'm Jason\u003cbr /\u003ehow are you"}
instead
{"Key":2,"Content":"I'm Jason <br /> how are you"}
when I add it to the Div using the jQuery template, it prints something like this:
I'm Jason <br /> how are you
while the intended result should be
I'm Jason
how are you
I suppose the server does not encode the string on the server side? But I think this may cause a security problem. So I think I need to decode the Json string on the client side, but so far no luck. Can someone show me a suitable way to deal with this problem?
thank
* Updated
I tested using jQuery('#someDiv').append(data.Content);and printed it out as I see fit.
So the problem is probably related to the jQuery template
I use this code to transfer data to a jQuery jQuery('#someTemplate').tmpl(data).appendTo('#someDiv');
template. My jQuery template
<script id="someTemplate" type="text/x-jquery-tmpl">
<div>${Content}</div>
</script>