Add loader on ajax call

I want to add a loader in my costum module on ajax call. I have no idea how to do it can you point me in right direction?

@Gunjan04

  1. Look at the array in file modules/Contacts/metadata/detailviewdefs.php
...
      'includes' =>
      array(
        0 =>
        array(
          'file' => 'modules/Contacts/Contact.js',
        ),
      ),
...

This is load of javascript.

  1. Look at the function in file
    modules/Contacts/controller.php
...
    public function action_ValidPortalUsername()
    {
        $this->view = 'validportalusername';
    }
...

This is the point of ajax call. The call can be as:
index.php?module=Contacts&action=ValidPortalUsername...

This is for one module if you want do call from different modules you should do entrypoint (https://docs.suitecrm.com/developer/entry-points/).

Not able to understand your answer.
What I want is that on entering loan number an api is fetching customer details through ajax call…and I want to add a loader in the time being customer details get fetched.

@Gunjan04

Look at the documentation about API:


If you will have any questions, write here.