3
我用编辑器在我的页面时,我想用AJAX来更新我的价值观,我得到这个错误: 遗漏的类型错误:转换圆形结构,以JSON转换圆形结构,以JSON的HTML。发送值控制器
这是我的看法:
@{
Layout = null;
}
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Edit</title>
<script type="text/javascript">
$(function() {
$("#editor").kendoEditor({
value: "@Html.Raw(Model.Content)"
});
$("#back").click(function() {
$.get('@Url.Action("Index", "Editor")', { siteId: "@ViewBag.SiteId", widgetId: "@Model.WidgetId" },
function (data) {
$("div[data-role='popup']").remove();
var indexContent = $(data).find("#content");
$(indexContent).fadeIn(101);
$("#content").replaceWith(indexContent);
});
});
var content = $("#editor").data("kendoEditor");
$("#save").click(function() {
var editor = {
Id: 1,
Content: content,
Title: 1,
};
$.ajax({
url: '@Url.Action("Update", "Editor")',
type: "POST",
contentType: "application/json charset=UTF-8",
dataType: "json",
data: JSON.stringify(editor),
});
});
});
</script>
</head>
<body>
<div id="editorContainer">
<div id="editorContent">
<input type="text" value="@Model.Title" style="width:300px" id="title"/>
<textarea id="editor" rows="10" cols="30" style="width: 740px; height: 440px">
</textarea>
</div>
</div>
<button id="save">ذخیره</button>
<button id="back">بازگشت</button>
</body>
</html>
在我看来我发布价值与jquery ajax但我得到错误。
请给我解释一下 –