Magento – Ajax request disable modal / loading-mask

adminhtmlajaxprototype-js

new Ajax.Request('<?php echo $this->getUrl('adminhtml/notification/check') ?>', {
        //parameters: {isAjax: 'true', form_key: FORM_KEY},#
        method: 'post',
        onSuccess: function(transport) {
            try {
                    $('notification').replace(transport.responseText);
            }
            catch (e) {
                $('notification').replace(transport.responseText);
            }
        }
    });

I'm making this ajax request in an adminthml page. It makes the page modal and waits for the ajax request to complete showing the user please wait and the spinner, the user cannot click anywhere in the page whilst the spinner / ajax request is active.

I would like to disable the modal please wait spinner for this particular ajax request as I want it to update a div automatically in the background.

Best Answer

found the answer, to unregister the varienloaderhandler

new Ajax.Request('<?php echo $this->getUrl('adminhtml/notification/check') ?>', {
        //parameters: {isAjax: 'true', form_key: FORM_KEY},#
        method: 'post',
        onCreate: function(request) {
            Ajax.Responders.unregister(varienLoaderHandler.handler);
        },
        onSuccess: function(transport) { 
            Ajax.Responders.register(varienLoaderHandler.handler);
            try {
                    $('notification').replace(transport.responseText);
            }
            catch (e) {
                $('notification').replace(transport.responseText);
            }
        }
    });
Related Topic