0

In webforms i used to do this

Page.ClientScript.RegisterStartupScript(this.GetType(),"CallMyFunction","MyFunction()",true);

on mvc 5 how am i supposed to do this? I want to show a notification for example after something is inserted or updated in database

example i I have a controller

public class RecordsController : Controller
{
    public ActionResult Post()   
    {

        // Insert record in database and return rows modified
        // Show notification

    }
}
3
  • 2
    You include a script block in the view that you return from the action, in one way or another (directly in the body of the view, referenced with a script tag from the view, referenced with a script tag from a layout etc.) Commented Apr 13, 2019 at 17:32
  • could you show me an example of this? if its not asking much Commented Apr 13, 2019 at 17:42
  • Possible duplicate of What is the difference between client-side and server-side programming? Commented Apr 13, 2019 at 18:21

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.