jQuery Form, ASP.NET MVC JSon Result
Posted
by Stacey
on Stack Overflow
See other posts from Stack Overflow
or by Stacey
Published on 2010-01-28T20:34:48Z
Indexed on
2010/03/28
12:33 UTC
Read the original article
Hit count: 446
jQuery
|asp.net-mvc
I'm trying to return a json result from a jQuery Form instance - but it keeps prompting me to download a file instead of displaying it in the window like it is supposed to...
$("#ajaxImageForm").ajaxForm({
iframe: true,
type: "GET",
dataType: "json",
beforeSubmit: function() {
$("#ajaxImageForm").block({ message: '<img src="/content/images/loader.gif" /> Uploading . . .' });
},
success: function(result) {
$("#ajaxImageForm").unblock();
$.growlUI(null, result.message);
}
});
[AcceptVerbs(HttpVerbs.Post)]
public JsonResult Edit(FormCollection collection)
{
// return Json to the jQuery Form Result
return new JsonResult { Data = new { message = string.Format("edited successfully.") } };
}
© Stack Overflow or respective owner