A quick and dirty way to do this would be to create a semi transparent div with a really high z-index positioned absolutely and the full size of the page. When a user clicks a button, show this div which will block interaction with all content under it. Then, when the server is done, hide the div. Something like this:
$('.myBtn').click(function() {
$('#result').append('Button Clicked!<br>');
$('#pageshield').show();
setTimeout(function() {
$('#pageshield').hide();
}, 2000);
});
.container {
position: relative;
}
#pageshield {
display: none;
z-index: 999999999;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: #000000;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
/* IE 8 */
filter: alpha(opacity=50);
/* IE 5-7 */
-moz-opacity: 0.5;
/* Netscape */
-khtml-opacity: 0.5;
/* Safari 1.x */
opacity: 0.5;
/* Good browsers */
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="container">
<div id="pageshield"></div>
<button class="myBtn">Click me</button>
<br>
<button class="myBtn">Click me</button>
<br>
<button class="myBtn">Click me</button>
<br>
<button class="myBtn">Click me</button>
<br>
<button class="myBtn">Click me</button>
<br>
<div id="result"></div>
</div>
Disclaimer, this works but does seem a bit hackish.
Also, if possible, consider changing the way your app works instead. In my opinion, blocking the whole page like this is bad UX. Which is the very reason the synchronous Ajax calls were deprecated