Show loader till ajax call is not completed in Magento 2 to restrict users perform any other activity until the response is received.
Show loader on Ajax call to let people know their request is in process using the method at https://meetanshi.com/blog/magento-2-show-loader-till-ajax-call-not-completed/