How to show loader widget in ajax call Magento 2?

You can show Magento native loader widget icon on a page for an ajax request.

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

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 for 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