jquery - Json returned my HTML <br /> in unicode form \u003cbr /\u003e . Causing the <br /> printed as a text rather than making a new line -


i'm using asp.net mvc3 , returned model in json format using jquery.ajax , pass jquery template printed out.

for example json server returned {"key":2,"content":"i'm jason\u003cbr /\u003ehow you"} instead of {"key":2,"content":"i'm jason <br /> how you"}

when append div using jquery template printed out this:

i'm jason <br /> how you

while intended result should be

i'm jason  how 

am suppose prevent server encoding string in server side? think may cause security issue.
therefore think have decode json string in client side no luck far. can show me appropriate way deal kind of problem?
thanks

*updated
tested jquery('#somediv').append(data.content); , print out intended.
problem related jquery template

i'm using code pass data jquery template jquery('#sometemplate').tmpl(data).appendto('#somediv');
jquery template

<script id="sometemplate" type="text/x-jquery-tmpl">  <div>${content}</div> </script> 

i ran same issue. no need encode/decode or escape/unescape.

instead of this:

${content} 

use this:

{{html content}} 

the unicode displayed html.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -