Disable page behind on processing using Javascript in MVC4
<p>I am using MVC4 in my project. On click of a button on a page, I need to show a dialog and then on confirmation, I need to do an event processing.</p>

<pre><code>  $('#btn1).click(function (e) {

            e.preventDefault();
            var meetingvar = new Array();
            var cells = $(this).closest('td').siblings('td');
            meetingvar = $(cells[2]).text().split(",");
            var params = {};
            params.meetingdate = meetingvar[0];
            params.meetingstate = meetingvar[1];
            params.meetingvenue = meetingvar[2];

            $.ajax(
                            {
                                type: 'GET',
                                url: '/[Controler]/[action1],
                                data: { MeetingDate: params.meetingdate, MeetingState: params.meetingstate, MeetingVenue: params.meetingvenue },
                                beforeSend: function (jqXHR, settings) {
                                    setLoaderLabel('Please wait...');
                                    showLoader();
                                }
                            }).done(function (data, textStatus, jqXHR) //success callback
                            {
                                if ($.trim(data) == 1) {
                                    var dialog = $('&lt;p&gt;Confirmation Required. Do you want to overwite ?&lt;/p&gt;').dialog({
                                        buttons: {
                                            "Yes": function () { //alert('you chose yes'); 
                                                window.location.href = '/[Controller]/[Action2]?MeetingDate=' + meetingvar[0] + '&amp;MeetingState=' + meetingvar[1] + '&amp;MeetingVenue=' + meetingvar[2] + '&amp;toGen=1';
                                            },
                                            "No": function () { //alert('you chose no'); 
                                                window.location.href = '/[controller]/[action2]?MeetingDate=' + meetingvar[0] + '&amp;MeetingState=' + meetingvar[1] + '&amp;MeetingVenue=' + meetingvar[2] + '&amp;toGen=0';
                                            },
                                            "Cancel": function () {
                                                dialog.dialog('close');
                                            }
                                        }
                                    });
                                }
                                if ($.trim(data) == 0) {
                                    showLoader();
                                    window.location.href = '/[controller]/[action1]?MeetingDate=' + meetingvar[0] + '&amp;MeetingState=' + meetingvar[1] + '&amp;MeetingVenue=' + meetingvar[2] + '&amp;toGen=1';
                                }
                                if ($.trim(data) == 2) {
                                    ShowErrorMessage('&lt;p&gt;NOT DEFINED&lt;/p&gt;');
                                }
                            }).fail(function (jqXHR, textStatus, errorThrown) //error callback
                            {
                                var errorMsg = GetAjaxResponseTitle(jqXHR.responseText);
                                ShowErrorMessage('&lt;p&gt;' + errorThrown + '&lt;/p&gt;' + errorMsg);
                                hideLoader();
                            }).always(function () //complete callback
                            {
                                hideLoader();
                            });


        });
</code></pre>

<p>Here , on success, from first action1 is it going to success, with the Loader(basically disabling the main page). But I need the same Loader functionality on Click of Yes or No, because, before redirecting  there is an event which takes some time. At this stage, shouldn't allow user to click on any other button on the base page. Don't know how to achieve this. Please appreciate any help.</p>

<p>Thanks In advance</p>