How to Block an AJAX Call
The asynchronous nature of AJAX makes it difficult to open a Web page without having a server request go out by default. There may be times when you want to block that server request, known as an AJAX call, and prevent it from querying your server while allowing the remainder of the page to continue loading. This is tricky because preventing a default AJAX call requires you to transform the script from asynchronous to synchronous, which will block the rest of the Web page's content from loading. You can avoid this by using the BlockUI code.
Instructions
-
-
1
Open the Web page in which you want to block the AJAX call by right-clicking on the file and choosing "Open With" from the context menu. Select "Notepad" from the Programs window that appears. The file will open in your text editor.
-
2
Add the following code directly above the AJAX code that you want to block:
blockUI();
-
-
3
Add a custom message if you want the visitor to know that the AJAX call has been blocked using the following code:
blockUI({ message: '<h5> This script has been temporarily blocked. </h5>' });
Replace "This script has been temporarily blocked" with whatever message you want to display to your site visitors.
-
1