I am trying to return a JSON object via AJAX using jQuery, that may contain elements that need HTML Tags. It is not great practice to include HTML tags within a JSON response and even so, it will be encoded at the other end so may cause more problems.
Consider this result:
{
"Country_Code":"EL",
"Country_Name":"Greece",
"Total_Value":5,
"Formatted_Value":"5m3"
}
The 'Formatted_Value' needs to look like this: 5m3. My question is simply, what would be the best way to achieve this with a returned JSON object?
If HTML is the best way then I will implement this, but only as a last resort as returning markup in a JSON request is not very good.
you could change the Json in this way:
"Formatted_Value":"5m³"
Using ³
(³) entity: http://code.google.com/p/doctype-mirror/wiki/Sup3CharacterEntity