我正在使用CLEditor为我的应用程序用户提供 html 编辑器,CLEditor 使用文本区域来维护生成的 html,我正在使用 jquery ajax 来保存 html:
$(".btnSave").click(function () {
var description = $(this).find("textarea[name='Description']").val();
$.ajax({
url: "/Product/SaveDescription",
data: { description: description },
success: function (result) {
alert("Saved successfully.");
},
error: function (xhr, state, msg) {
alert(msg);
}
});
});
但是当我的变量(描述)包含 html 标签时,该操作不会触发,并且出现错误(内部服务器错误)。
这是我的操作方法:
public void SaveDescription(string description)
{
//save the description
}
如您所见,我没有使用需要 AllowHtml 属性来允许 html 的 MVC 模型绑定器,那么问题是什么?
谢谢你的帮助。