Hi,
I am developing application in Asp.net MVC.
I submit the form with using jquery:
var Data = $("#frmForgotPassword").serialize();
$.post("<%= Url.Action("ForgotPassword","Account") %>/", Data, function(retdata, textStatus) {
if (textStatus == "success") {
if (retdata.status == false) {
$("#error").html('<p class="error">Error: ' + retdata.msg + '</p>');
}
else {
$("#error").html('<div class="clean-ok">Success: ' + retdata.msg + '</div>');
}
}
else
alert("error: " + textStatus);
}, "json");
But I get the response as file open, shown here.
My controller returns the json as follow:
return Json(new { status = false, msg = "User name or email is not registered with us!" });
or
return Json(new { status = true, msg = "Your username and password has been sent to your email address!" });
So where is the mistake? How to stop opening response as file? It gives the same error in IE also.
EDIT:
Request header:
Host localhost:16293
User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.6) Gecko/20100625 Firefox/3.6.6
Accept application/json, text/javascript, */*
Accept-Language en-us,en;q=0.5
Accept-Encoding gzip,deflate
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive 115
Connection keep-alive
Content-Type application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With XMLHttpRequest
Referer http://localhost:16293/Account.aspx/LogOn?ReturnUrl=%2fdefault.aspx
Content-Length 15