How can I send a big HTML block in JSON
I need to send a big block of HTML in a Json object like this:
JsonResult jsn = Json(new Dictionary<string, object> { { "success", true },
{ "lastPID", posts[0].ID },
{ "content", "" } });
return jsn;
For some reason I get this error when I put that html block into the content variable: Server cannot set content type after HTTP headers have been sent.
This doesn't happen if I return some random non-html content.
Is there any encoding that I need to do before I can send my big block of html?
What 开发者_StackOverflow中文版about the client end? How do I get back the data.
Looks like this is your problem (and solution)
If you need to send HTML, why not just send HTML rather than JSON?
精彩评论