Pregunta

Si haces esto en MVC:

var jsonData = 
    new { myimage = 
        "<img alt=\"\" src=\"/Content/images/ShowFPots.png\" />" };

return Json(jsonData);

Obtiene esto como un valor

"\u003cimg alt=\"\" src=\"/Content/images/ShowFPots.png\" /\u003e"

¿Cómo obtengo esto como un valor, o lo haré < > interpretar correctamente cuando los agrego al innerHtml ??

"<img alt=\"\" src=\"/Content/images/ShowFPots.png\" />"
¿Fue útil?

Solución

que es JavaScript correcto, codificación Unicode. Estará bien insertarlo en html / DOM

https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Unicode

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top