Search code examples
jqueryasp.net-mvcasp.net-mvc-3jquery-uiblockui

How to display controller action view in blockUI


I am trying to set blockUI message to display controller action view. I have tried everything but it doesn't display anything.
I have tried something like this:

$.blockUI({
             message: $('MyController/MyAction'), // I also need to pass some parameters here
        css: {
        top: ($(window).height() - 600) / 2 + 'px',
        left: ($(window).width() - 600) / 2 + 'px',
        width: '600px'
        }
        });

What I am trying to make is image display like on facebook for my image gallery. And I have a view that contains Image/Comments/Back/Next but I failed to display it in modal form. enter image description here


Solution

  • This is not the correct way to call an ajax method :=)

    $('MyController/MyAction')
    

    jQuery is magic, but not that magic !

    Instead use:

    $.ajax({url:'/controller/action',success: function(d){ $.blockUI(..., message: d,  ...) }})