JSON'ta bir nesneyi nasıl serileştirebileceğimi gördüm. Bir ViewResult
döndüren bir dizeyi nasıl POST gönderebilirim?mvc'ye bir dize gönderin
$.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 Bir json biçimi olarak sonuç döndürmez isteyebilirsiniz
[HttpPost]
public ActionResult SomeReport(string input)
{
var model = new ReportBL();
var report = model.Process(input);
return View(report);
}
bir bu yazı bakmak ve Darin yanıtını Var: http://stackoverflow.com/questions/5046930/jquery-send-string-as -post-parametreleri – Sam