If you can, you'd better return JSON to the browser and use a template plugin like jQuery tmpl to display json in HTML for display, since tmpl does great caching, which speeds up work in slower browsers like IE, It also makes JSON response easier . Example:
<script id="template" type="text/x-jquery-tmpl"> <span class="message">${text}</span> </script> <script type="text/javascript"> $.ajax( { url: url, dataType: 'json', cache: false, success: function (data) { $("#targetElementId").html($("#template").tmpl(data)); } }); </script>
Your JSON response should be formatted so that it matches the pattern:
{ text: "Blah!" }
source share