Search code examples
asp.netasp.net-mvccontrollermessagebox

How to show Messagebox from MVC Controller


can anyone please tell about showing message box from MVC controller? The scenario is - I want to show a message box with Yes/No buttons. On clicking Yes i want to show a confirmation message box. I want to do this using MVC controller? How can I do this?

Thanks in advance, Kaps


Solution

  • if (confirm('Are you sure?'))
    {
    $.post("Confirmation", {myresponse: 'yes'}, function(data)
    {
    $.("#mymodal").html(data);
    }
    }
    

    That way it hits the actionmethod and lets it know that a yes confirmation was made and the actionmethod can send back the html markup.