What about:
$.ajax({
url: url,
dataType: 'html',
data: {input: $(this).val()},
type: 'POST',
success: function (data) {
$("#report").html(data);
},
error: function (data) {
$("#report").html('An Error occured. Invalid characters include \'<\'. Error: ' + data);
}
});
If you create a dataJSON object object with a key that matches the parameter name, MVC should pick it up.
On the side of MVC ...
[HttpPost]
public ActionResult SomeReport()
{
string input = Request["input"];
var model = new ReportBL();
var report = model.Process(input);
return View(report);
}
Davy8 source
share