Hi All,
i have a partial view with a form in it. It is strongly typed.
I am using ajax in a view with the partial view in it to submit the form.
It's basically a form that creates a new DB item and i can see that the controller action is working and being called.
my ajax submit looks like this:
$(document).ready(function () {
var form = $("#addPost");
form.submit(function () {
$.ajax({
type: "POST",
url: form.attr("action"),
data: form.serialize(),
dataType: "json",
success: function (data) {
alert('success!');
},
error: function (req, status, err) {
alert('err=' + err + ' status=' + status);
}
});
return false;
});
});
So the controller perform the work just fine and attempts to return the strong type that the partialview is.. and i keep getting the error js alert with no info in it.
Is this because my parent view is not typed the same and it is the view that sent the ajax?
if this is so what is the solution? Am i going about this wrong? I need the parent page to get the response and then display the form info back on the page using js. thanks!