Loader hiding

Loader hiding

I want that my loader should hide only after the function is executed and i am not able to find the solution to this problem. as it runs async call so the loader gets hidden before only