afridi shayed afridi shayed - 1 month ago 7
AngularJS Question

AngularJs how to pass Json String into $scope.msg=msg.data

public JsonResult Authe(string Email, string Password, bool? Active)
{
var x = (from n in db.Authntications
where n.Email == Email && n.Password == Password
select n).FirstOrDefault();

if (x != null)
{
var xx = (from n in db.Authntications
where n.Email == Email && n.Password == Password && n.Active == Active
select n).FirstOrDefault();
if (xx == null)
{msg = "Your A/c not activated....";}}

else
msg = "Your Account Details Not Valid please check Details You mentiond...";
return new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet };
}


AngularJs

var ZmrSer = MyAuthneticService.Authen(Sucess);
$scope.msg = msg.data;
$('#modalSuccess').modal('show');

Answer

You should return Json from your action method with allowing get behavior.

return Json(msg, JsonRequestBehavior.AllowGet); 
Comments