Populate jquery modal dialog with MVC partial view async, and show in center of screen

前端 未结 3 2010
傲寒
傲寒 2021-02-02 00:33

I\'m trying to use the jquery modal dialog to show a partial view async when clicking on something. Pretty simple, and there are loads of questions on this, but I can\'t seem to

3条回答
  •  一向
    一向 (楼主)
    2021-02-02 01:02

    Your code looks fine and it worked when I tested it. Here's my full test case:

    Controller:

    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }
    
        public ActionResult MyActionOnController()
        {
            // TODO: You could return a PartialView here of course
            return Content("
    Hello world
    ", "text/html"); } }

    View (~/Views/Home/Index.cshtml):

    @{
        Layout = null;
    }
    
    
    
        
        Test
         
        
        
        
    
    
        
    Click Me

提交回复
热议问题