【发布时间】:2023-04-09 09:09:01
【问题描述】:
我已经了解了如何序列化为 JSON 中的对象。如何发布返回 ViewResult 的字符串?
$.ajax({
url: url,
dataType: 'html',
data: $(this).val(), //$(this) is an html textarea
type: 'POST',
success: function (data) {
$("#report").html(data);
},
error: function (data) {
$("#report").html('An Error occured. Invalid characters include \'<\'. Error: ' + data);
}
});
MVC
[HttpPost]
public ActionResult SomeReport(string input)
{
var model = new ReportBL();
var report = model.Process(input);
return View(report);
}
【问题讨论】:
-
看看这篇文章和达林的回答:stackoverflow.com/questions/5046930/…
标签: c# jquery asp.net-mvc-3