Disclaimer: I am a total noob when it comes to ASP.NET.
I am using the following jQuery code to submit my form:
$.ajax({
url: '/Foo/Save',
type: 'POST',
data: $('#dataInputForm').serialize(),
contentType: 'application/json; charset=utf-8',
success: function (data) {
alert(data.success);
},
error: function () {
alert("error");
}
});
My Foo
controller code is this:
[HttpPost]
public ActionResult Save()
{
return Json(new { success = true });
}
I know the AJAX post is working because I am seeing the alert with "success". Next, I would like to see a var dump somehow of my serialized form. I honestly do not know where to begin on the controller end but I would like my success alert to just dump my serialize form data just so that I can confirm that the form data that was submitted.
Essentially, this is what I would like the success alert to look like:
a=1&b=2&c=3&d=4&e=5
BONUS: I would love to see an alternative way of submitting the data in JSON and seeing the success alert in JSON.