Once you have your island setup as always like:
You might be surprised with your browser presenting you with “raw html” instead of that rendered page.
This is because with no precaution returning JsonResult would have an implication of content type to be set to “application/json”. To prevent this, just reset the content type to the one you need:
<div id="dataIsland_in" style="display: none">
@{
Html.RenderAction("GetModelIsland", new { variantId = Model.BidVariant.Id });
}
</div>
This is because with no precaution returning JsonResult would have an implication of content type to be set to “application/json”. To prevent this, just reset the content type to the one you need:
var result = Json(model, JsonRequestBehavior.AllowGet);
result.ContentType = "text/html";
return result;
More from me on json in asp.net mvc:
MVC 3 + Elmah - Handle Ajax/json action errors in a generic way
No comments:
Post a Comment