Hi,
I convert my MVC project to use Kendo UI. I have action result return simple Json object status with message if there is an error. It was working fine before I convert.
now it tries IE tries to download the Json, Firefox and Chrome will show it as text.
here is my code. I add ("text/html", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet) I was hoping it will fix it but it didn't
return Json(new { Success = true }, "text/html", System.Text.Encoding.UTF8,
JsonRequestBehavior.AllowGet);
return Json(new { Success = false, Message = formPost.Message }, "text/html", System.Text.Encoding.UTF8,
JsonRequestBehavior.AllowGet);
form
Ajax.BeginForm(new AjaxOptions { OnSuccess = "handleModalSubmit" })
JS
function handleModalSubmit(result) {
if (result.Success) {
alert("Your request was sent Successfully");
}
else {
alert("There was problem sending your request");
}
}
Here is my Kendo include files
<link href="@Url.Content("~/Content/kendo.compatibility.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/kendo/2013.2.918/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.918/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.918/kendo.aspnetmvc.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>
I convert my MVC project to use Kendo UI. I have action result return simple Json object status with message if there is an error. It was working fine before I convert.
now it tries IE tries to download the Json, Firefox and Chrome will show it as text.
here is my code. I add ("text/html", System.Text.Encoding.UTF8, JsonRequestBehavior.AllowGet) I was hoping it will fix it but it didn't
return Json(new { Success = true }, "text/html", System.Text.Encoding.UTF8,
JsonRequestBehavior.AllowGet);
return Json(new { Success = false, Message = formPost.Message }, "text/html", System.Text.Encoding.UTF8,
JsonRequestBehavior.AllowGet);
form
Ajax.BeginForm(new AjaxOptions { OnSuccess = "handleModalSubmit" })
JS
function handleModalSubmit(result) {
if (result.Success) {
alert("Your request was sent Successfully");
}
else {
alert("There was problem sending your request");
}
}
Here is my Kendo include files
<link href="@Url.Content("~/Content/kendo.compatibility.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2013.2.918/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" /> <script src="@Url.Content("~/Scripts/kendo/2013.2.918/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.918/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2013.2.918/kendo.aspnetmvc.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo.modernizr.custom.js")"></script>