How to call a jquery function from an action method in controller?
        Posted  
        
            by 
                Hasan Fahim
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Hasan Fahim
        
        
        
        Published on 2011-06-30T07:14:20Z
        Indexed on 
            2011/06/30
            8:22 UTC
        
        
        Read the original article
        Hit count: 273
        
jQuery
|asp.net-mvc-3
I have a requirement to open a popup from an action method in controller. The action method is basically registering a user.
[HttpPost]
public ActionResult Register(RegisterModel model)
{
    if (ModelState.IsValid)
    {            
        MembershipCreateStatus createStatus;
        Membership.CreateUser(model.UserName, model.Password, model.Email, null, null, true, null, out createStatus);
        if (createStatus == MembershipCreateStatus.Success)
        {
            FormsAuthentication.SetAuthCookie(model.UserName, false /* createPersistentCookie */);
            //------------------------------------------
            //I need to call a jquery function from here
            //------------------------------------------
            return RedirectToAction("Index", "Home");
        }
        else
        {
            ModelState.AddModelError("", ErrorCodeToString(createStatus));
        }
    }
    return View(model);
}
The jquery function, present in the view, would just make a hidden DIV, visible, and set the opacity, etc, to represent a popup.
I need to call such a jquery function from the controller's action method shown above.
© Stack Overflow or respective owner