How to show loader widget in ajax call Magento 2?

You can show/hide Ajax Loader in Magento Request using Built-in Magento Widget while working with ajax related stuff in the browser.

You can start the loader once the ajax request is started and you can stop the loader widget after the response is getting or failed.

Its simple to add loader widget icon for an ajax request.

You can start loader widget by calling below line,

You can disable loader widget icon by below line,

Full example to call Loader Widget in AJAX call,

    require(['jquery','domReady!'], function ($, urlBuilder, $t) {
        // start loader
            url: urlString,
            data: {},
            type: 'POST',
            dataType: 'json',
        }).done(function (response) {
        	//stop loader
        }).fail(function (response) {
        	//stop loader