Hi, I'm try to issue a post to a MVC action and displaying the resulting JSON on the web page. The action receives the post command but the result is showing up on a new page, instead of the same page. For example, it'll ask if I want to download or open the file. PS. I'm using jQuery validate as well.
my jquery:
submitHandler: function(form) {
$('#loading').show(); //adds waiting spinner
$.post(
$(form).attr('action'),
form.serialize(),
function(data) {
alert(data);
},
"json"
);
return false;
}
My action:
[AcceptVerbs(HttpVerbs.Post), ValidateAntiForgeryToken]
public ActionResult ContactUs(FormCollection collection) {
...
return Json("OK");
}
I've been banging my head on this and have read way too many web search but still no avail. Any help would be greatly appreciated.