Question

This is my first project and I am attempting to have the blockui fire when the application hits up the server for information. I looked up a few examples and thought my attempt below would work, but I was wrong.

        $(document).ajaxStart(function(){
        $.blockUI({
            css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
        });


        $(document).ajaxComplete(function(){
            $.unblockUI()
        });
Was it helpful?

Solution

If this is your full code, you forgot a }); for the $(document).ajaxStart(function(){ handler:

$(document).ajaxStart(function(){
    $.blockUI({
        css: {
            border: 'none',
            padding: '15px',
            backgroundColor: '#000',
            '-webkit-border-radius': '10px',
            '-moz-border-radius': '10px',
            opacity: .5,
            color: '#fff'
        }
    });
});   // <----- HERE


$(document).ajaxComplete(function(){
    $.unblockUI()
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top