【发布时间】:2013-03-09 03:55:53
【问题描述】:
我正在使用 Kendo UI 上传控件。我已经这样定义了 Kendo UI 上传:
<input type="file" name="resume" />
$("#file").kendoUpload({
async: {
saveUrl: "/Home/SaveResume",
autoUpload: true
},
complete: function (e)
{
// here i want to get the text that is returned from the controller
}
});
控制器代码如下:
public ActionResult SaveResume(HttpPostedFileBase resume)
{
var text;
// code for the file to convert to text and assign it to text
return Json(text, JsonRequestBehavior.AllowGet);
}
返回代码后,我想检索完整函数中的代码。我该怎么做?
【问题讨论】:
-
你有没有试过
console.log(e)看看返回了什么?我愿意成为e不是event,而是data returned from the srever。如果您使用var data = $.parseJSON(e),您最终可能会得到一个具有控制器定义的属性的数据对象。 -
是的,数据变量包含像
Server Response: the actual string这样的字符串。 -
被返回的项目
is一个对象,你使用了 parseJSON 并且它不是你发送的对象?在此处发布对象,使用 jsfiddle 并保存。 -
解析后我得到了像Server Resonse这样的数据:数据。我现在如何获取实际的字符串。
-
此 Kendo UI 帮助主题描述了如何从保存处理程序中检索数据:docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/…
标签: c# jquery asp.net-mvc kendo-ui