This is baseless.

I went to the rooftop of my house with my mother in Pakistan at 12:00 am midnight to walk. Initially, it was normal. Suddenly, me and mother felt a strange good smell passes by. My mother said to me to spit on my left and say “la haula wala qu ata illa billah”.Her grandfather used to tell her to do so as may be it could be any jinn or anything like that around or passing by. Is it true? Is it ok to do like this?